Files
MCMapper-Mod/common/run-tests.sh
T
octoturge 53cba762b4 Add standalone test coverage for common/'s MiniJson
Requested after MCMapper-Backend's Phase 2: development follows TDD
(test-first) from here on — this retrofits the piece already built
(MiniJson, the hand-rolled JSON codec) before that request landed.

No JUnit/Gradle involved, matching common/'s "must compile standalone
under plain javac" constraint (see README.md) — a hand-rolled assertion
runner in src/test/java, compiled and run via the new run-tests.sh.
Covers write escaping, nested object/array encoding, parsing (including
the exact columns-message shape DefaultBackendConnection actually
builds), and a write-then-parse round-trip.

Deliberately not wired into either leaf's build.gradle sourceSets (which
only pull in src/main/java) — verified both forge-1_12_2 and forge-1_7_10
still compile with src/test/ present, confirming test code doesn't leak
into the shipped mod jar.
2026-08-08 16:39:56 +02:00

22 lines
701 B
Bash

#!/usr/bin/env bash
# Compiles and runs common/'s standalone test classes (no JUnit, no Gradle — see README.md for
# why: common/ must compile under plain javac, independent of either leaf's ForgeGradle
# toolchain, and test code never ships in the mod jar so it doesn't need to match the leaves'
# JDK 8 target either). Any JDK on PATH works.
set -euo pipefail
cd "$(dirname "$0")"
OUT=$(mktemp -d)
trap 'rm -rf "$OUT"' EXIT
javac -d "$OUT" $(find src/main/java src/test/java -name '*.java')
status=0
for class in $(find src/test/java -name '*Test.java' | sed 's#src/test/java/##; s#\.java$##; s#/#.#g'); do
echo "== $class =="
java -cp "$OUT" "$class" || status=1
echo
done
exit $status