From 29687d039bd952008d587bf3bc7f920e5302ba8c Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Tue, 3 Nov 2026 10:45:04 +0100 Subject: [PATCH] urust: fix unit tests --- src/common/toolmeta.ts | 6 ++++-- test/unit/testurust.ts | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/toolmeta.ts b/src/common/toolmeta.ts index 174abf81..18a0debe 100644 --- a/src/common/toolmeta.ts +++ b/src/common/toolmeta.ts @@ -273,8 +273,8 @@ const URUST_MOD_PATTERN = /^\s*(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_][A-Za-z0 // The modules in crates/rs8/src (and the io/host shims) that urust bundles. // `rs8::lib` is the crate root, not a module a program can name. export const URUST_RS8_MODULES = [ - 'apple2', 'atari8', 'bcd', 'beeper', 'c64', 'cbm', 'coleco', 'conio', - 'console', 'containers', 'far', 'fixed', 'font', 'host', 'io', 'joy', + 'apple2', 'atari8', 'atari7800', 'bcd', 'beeper', 'c64', 'cbm', 'coleco', 'conio', + 'console', 'containers', 'far', 'fixed', 'font', 'gb', 'host', 'io', 'joy', 'key', 'math', 'mem', 'msx', 'nes', 'notes', 'palette', 'rand', 'serial', 'text', 'tms9918', 'tone', 'vcs', 'vic20', 'zx', ]; @@ -285,9 +285,11 @@ export const URUST_RS8_MODULES = [ export const URUST_RS8_CHILDREN: { [module: string]: string[] } = { apple2: ['console', 'tone', 'util'], atari8: ['console', 'tone', 'util'], + atari7800: ['pokey'], c64: ['console', 'tone', 'util'], cbm: ['console', 'regs'], coleco: ['util'], + gb: ['tone', 'util'], host: ['console', 'tone'], msx: ['util'], nes: ['console', 'tone', 'util'], diff --git a/test/unit/testurust.ts b/test/unit/testurust.ts index 672af185..e8168857 100644 --- a/test/unit/testurust.ts +++ b/test/unit/testurust.ts @@ -73,9 +73,14 @@ describe('urust tool', function () { if (!fs.existsSync(zipfile)) return this.skip(); // /rs8/.rs has to resolve for every module the include pattern links const zip = await JSZip.loadAsync(fs.readFileSync(zipfile)); - for (const f of ['lib.rs', 'apple2.rs', 'atari8.rs', 'c64.rs', 'conio.rs', 'io.rs', 'nes.rs', 'rand.rs', 'vcs.rs', 'vic20.rs', 'zx.rs']) { + for (const f of ['lib.rs', 'apple2.rs', 'atari8.rs', 'c64.rs', 'conio.rs', 'gb.rs', 'io.rs', 'nes.rs', 'rand.rs', 'vcs.rs', 'vic20.rs', 'zx.rs']) { assert.ok(zip.file('rs8/' + f), 'missing rs8/' + f); } + // and every module the pattern links has to be in the package too (a + // module urust dropped must not linger in URUST_RS8_MODULES) + for (const module of URUST_RS8_MODULES) { + assert.ok(zip.file(`rs8/${module}.rs`), `missing rs8/${module}.rs`); + } // nested modules too: a link to rs8/nes/util.rs has to find the file for (const [module, children] of Object.entries(URUST_RS8_CHILDREN)) { for (const child of children) {