From ee22f833a0b1bdce445cdca79ba5e26917577107 Mon Sep 17 00:00:00 2001 From: nicodes Date: Tue, 3 Nov 2026 23:40:56 -0700 Subject: [PATCH] Keep starter resources in src and CLI journeys in root tests --- .github/workflows/cli-native.yml | 2 +- .gitignore | 2 +- crates/manifest/src/tests.rs | 2 +- crates/plugin/src/tests.rs | 2 +- crates/registry/src/tests.rs | 2 +- scripts/check_archives.py | 2 +- scripts/test.sh | 8 ++++---- {internal => src/assets}/starter/SOURCE.json | 0 .../assets}/starter/packs/asteroid.tcade | Bin .../assets}/starter/packs/brickough.tcade | Bin {internal => src/assets}/starter/packs/tetris.tcade | Bin src/local.rs | 6 +++--- src/ui/tests.rs | 7 +++---- .../test-requirements.txt => tests/requirements.txt | 0 {scripts => tests}/test_installer.py | 0 {scripts => tests}/test_rust_cli.py | 0 {scripts => tests}/test_rust_tui.py | 0 17 files changed, 16 insertions(+), 17 deletions(-) rename {internal => src/assets}/starter/SOURCE.json (100%) rename {internal => src/assets}/starter/packs/asteroid.tcade (100%) rename {internal => src/assets}/starter/packs/brickough.tcade (100%) rename {internal => src/assets}/starter/packs/tetris.tcade (100%) rename scripts/test-requirements.txt => tests/requirements.txt (100%) rename {scripts => tests}/test_installer.py (100%) rename {scripts => tests}/test_rust_cli.py (100%) rename {scripts => tests}/test_rust_tui.py (100%) diff --git a/.github/workflows/cli-native.yml b/.github/workflows/cli-native.yml index 3802053..4728901 100644 --- a/.github/workflows/cli-native.yml +++ b/.github/workflows/cli-native.yml @@ -91,7 +91,7 @@ jobs: cargo +1.94.0 build --bin termcade --locked --target "$RUST_TARGET" binary="target/$RUST_TARGET/debug/termcade" [ "$RUNNER_OS" != Windows ] || binary+=.exe - python3 scripts/test_rust_cli.py --binary "$binary" --wasm target/wasm32-wasip1/release/termcade_probe_fixture.wasm --expected-version "$VERSION" + python3 tests/test_rust_cli.py --binary "$binary" --wasm target/wasm32-wasip1/release/termcade_probe_fixture.wasm --expected-version "$VERSION" - name: Build release archive env: RELEASE_PLATFORM: ${{ matrix.platform }} diff --git a/.gitignore b/.gitignore index 824fcaf..ca15ca4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ games/*/build/ *.tcade # …except the starter pack, embedded in the Rust binary. These committed # content assets come from termcade-games; ABI-v1 packages remain compatible. -!internal/starter/packs/*.tcade +!src/assets/starter/packs/*.tcade !crates/plugin/testdata/legacy-starters/*.tcade game.wasm diff --git a/crates/manifest/src/tests.rs b/crates/manifest/src/tests.rs index 7de63be..3e5c5b3 100644 --- a/crates/manifest/src/tests.rs +++ b/crates/manifest/src/tests.rs @@ -140,7 +140,7 @@ fn package_rejects_extra_duplicate_nested_encrypted_nonregular_corrupt_and_overs #[test] fn original_bundled_go_packages_still_parse_and_install_without_changing_guest_bytes() { - let packs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../internal/starter/packs"); + let packs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../src/assets/starter/packs"); let destination = tempfile::tempdir().unwrap(); let mut names = Vec::new(); for entry in fs::read_dir(packs).unwrap() { diff --git a/crates/plugin/src/tests.rs b/crates/plugin/src/tests.rs index 44c88ff..9e517fd 100644 --- a/crates/plugin/src/tests.rs +++ b/crates/plugin/src/tests.rs @@ -98,7 +98,7 @@ async fn legacy_go_starter_fixtures_run_in_the_rust_host_at_every_density() { #[tokio::test] async fn current_starters_run_in_the_rust_host_at_every_density() { - check_game_packages("../../internal/starter/packs").await; + check_game_packages("../../src/assets/starter/packs").await; } async fn check_game_packages(relative: &str) { diff --git a/crates/registry/src/tests.rs b/crates/registry/src/tests.rs index 76d9e77..48d67bc 100644 --- a/crates/registry/src/tests.rs +++ b/crates/registry/src/tests.rs @@ -172,7 +172,7 @@ async fn errors_and_metadata_are_bounded_and_terminal_safe() { } #[tokio::test] async fn package_digest_length_identity_and_requirements_are_verified() { - let raw = include_bytes!("../../../internal/starter/packs/asteroid.tcade").to_vec(); + let raw = include_bytes!("../../../src/assets/starter/packs/asteroid.tcade").to_vec(); let package = termcade_manifest::Package::read(&raw).unwrap(); let m = package.manifest; let resolution = json!({"id":m.game.id,"version":m.game.version,"size":raw.len(),"sha256":format!("{:x}",Sha256::digest(&raw)),"abi":m.requirements.abi,"width":m.requirements.width,"height":m.requirements.height}); diff --git a/scripts/check_archives.py b/scripts/check_archives.py index 7c5706c..7b165ab 100644 --- a/scripts/check_archives.py +++ b/scripts/check_archives.py @@ -60,6 +60,6 @@ def main(): desired=next(target for system,arch,ext,target in MATRIX if host_archive().name==f'termcade_{system}_{arch}.{ext}') assert identity['target']==desired,'native target mismatch' fixture=Path(os.environ.get('CARGO_TARGET_DIR','target'))/'wasm32-wasip1/release/termcade_probe_fixture.wasm' - subprocess.run(['python3','scripts/test_rust_cli.py','--binary',str(binary),'--wasm',str(fixture),'--expected-version',version],check=True) + subprocess.run(['python3','tests/test_rust_cli.py','--binary',str(binary),'--wasm',str(fixture),'--expected-version',version],check=True) print(f'{len(expected)} native archives, exact checksums, source identity and CLI journeys verified') if __name__=='__main__':main() diff --git a/scripts/test.sh b/scripts/test.sh index 759c0ea..8fc2541 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -4,7 +4,7 @@ cargo build --locked --release --target wasm32-wasip1 --manifest-path crates/plu cargo build --locked --release --target wasm32-wasip1 --manifest-path crates/plugin/testdata/hang-rust/Cargo.toml cargo test --workspace --all-targets --locked cargo build --bin termcade --locked -python3 scripts/test_rust_cli.py --binary "${CARGO_TARGET_DIR:-target}/debug/termcade" --wasm "${CARGO_TARGET_DIR:-target}/wasm32-wasip1/release/termcade_probe_fixture.wasm" --expected-version "${VERSION:-dev}" -python3 scripts/test_installer.py -python3 -m pip install --disable-pip-version-check --no-cache-dir --require-hashes --target .artifacts/pty-python -r scripts/test-requirements.txt -PYTHONPATH=.artifacts/pty-python python3 scripts/test_rust_tui.py --binary "${CARGO_TARGET_DIR:-target}/debug/termcade" --wasm "${CARGO_TARGET_DIR:-target}/wasm32-wasip1/release/termcade_probe_fixture.wasm" +python3 tests/test_rust_cli.py --binary "${CARGO_TARGET_DIR:-target}/debug/termcade" --wasm "${CARGO_TARGET_DIR:-target}/wasm32-wasip1/release/termcade_probe_fixture.wasm" --expected-version "${VERSION:-dev}" +python3 tests/test_installer.py +python3 -m pip install --disable-pip-version-check --no-cache-dir --require-hashes --target .artifacts/pty-python -r tests/requirements.txt +PYTHONPATH=.artifacts/pty-python python3 tests/test_rust_tui.py --binary "${CARGO_TARGET_DIR:-target}/debug/termcade" --wasm "${CARGO_TARGET_DIR:-target}/wasm32-wasip1/release/termcade_probe_fixture.wasm" diff --git a/internal/starter/SOURCE.json b/src/assets/starter/SOURCE.json similarity index 100% rename from internal/starter/SOURCE.json rename to src/assets/starter/SOURCE.json diff --git a/internal/starter/packs/asteroid.tcade b/src/assets/starter/packs/asteroid.tcade similarity index 100% rename from internal/starter/packs/asteroid.tcade rename to src/assets/starter/packs/asteroid.tcade diff --git a/internal/starter/packs/brickough.tcade b/src/assets/starter/packs/brickough.tcade similarity index 100% rename from internal/starter/packs/brickough.tcade rename to src/assets/starter/packs/brickough.tcade diff --git a/internal/starter/packs/tetris.tcade b/src/assets/starter/packs/tetris.tcade similarity index 100% rename from internal/starter/packs/tetris.tcade rename to src/assets/starter/packs/tetris.tcade diff --git a/src/local.rs b/src/local.rs index 7993a4c..dd95485 100644 --- a/src/local.rs +++ b/src/local.rs @@ -164,9 +164,9 @@ pub fn seed_at(base: &Path) -> Result<()> { fs::create_dir_all(base)?; let mut changed = false; for raw in [ - include_bytes!("../internal/starter/packs/asteroid.tcade").as_slice(), - include_bytes!("../internal/starter/packs/tetris.tcade").as_slice(), - include_bytes!("../internal/starter/packs/brickough.tcade").as_slice(), + include_bytes!("assets/starter/packs/asteroid.tcade").as_slice(), + include_bytes!("assets/starter/packs/tetris.tcade").as_slice(), + include_bytes!("assets/starter/packs/brickough.tcade").as_slice(), ] { let pkg = Package::read(raw)?; if seeded.contains(&pkg.manifest.game.id) { diff --git a/src/ui/tests.rs b/src/ui/tests.rs index a339c1f..3802232 100644 --- a/src/ui/tests.rs +++ b/src/ui/tests.rs @@ -297,10 +297,9 @@ async fn rust_guest_plays_pauses_finishes_and_queues_a_run_once() { #[tokio::test] async fn standard_playfield_fits_80_by_24_in_every_pixel_style_and_pause_can_sign_in() { let (mut app, _dir, _rx) = app(); - let package = termcade_manifest::Package::read(include_bytes!( - "../../internal/starter/packs/tetris.tcade" - )) - .unwrap(); + let package = + termcade_manifest::Package::read(include_bytes!("../assets/starter/packs/tetris.tcade")) + .unwrap(); for shape in [ CellShape::half(), CellShape::quadrant(), diff --git a/scripts/test-requirements.txt b/tests/requirements.txt similarity index 100% rename from scripts/test-requirements.txt rename to tests/requirements.txt diff --git a/scripts/test_installer.py b/tests/test_installer.py similarity index 100% rename from scripts/test_installer.py rename to tests/test_installer.py diff --git a/scripts/test_rust_cli.py b/tests/test_rust_cli.py similarity index 100% rename from scripts/test_rust_cli.py rename to tests/test_rust_cli.py diff --git a/scripts/test_rust_tui.py b/tests/test_rust_tui.py similarity index 100% rename from scripts/test_rust_tui.py rename to tests/test_rust_tui.py