Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.4 kB · 31 lines
Python
at main
1234567891011121314151617181920212223242526272829303132"""The committed classes in patch/prebuilt must match patch/src."""import sysimport unittestfrom pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "tools"))from build_patch import DIGEST_FILE, sources_digest # noqa: E402from classfile import JAVA_1_4_MAJOR, ClassFile # noqa: E402from facade_install import PREBUILT_CLASSES # noqa: E402from patch_manifest import GENERATED, PREBUILT # noqa: E402
class PrebuiltTests(unittest.TestCase): def test_prebuilt_classes_were_built_from_the_current_sources(self): self.assertEqual(DIGEST_FILE.read_text(encoding="ascii").strip(), sources_digest(), "patch/src changed: run tools/build_patch.py and commit patch/prebuilt")
def test_every_shipped_class_is_present_and_targets_java_1_4(self): for name in PREBUILT: parsed = ClassFile((PREBUILT_CLASSES / name).read_bytes()) self.assertEqual(parsed.major, JAVA_1_4_MAJOR, name)
def test_no_game_code_is_shipped(self): # PreprocessorRules is the game's own class; the installer makes it locally. shipped = {p.relative_to(PREBUILT_CLASSES).as_posix() for p in PREBUILT_CLASSES.rglob("*.class")} self.assertEqual(shipped, set(PREBUILT)) self.assertFalse(shipped & set(GENERATED))
if __name__ == "__main__": unittest.main()