urust: fix unit tests

This commit is contained in:
Steven Hugg committed 2026-11-03 10:45:04 +01:00
1 parent 9790a3fe96
commit 29687d039b
2 files changed
+10 -3

No files matched your search

+4 -2
View File
@@ -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'],
+6 -1
View File
@@ -73,9 +73,14 @@ describe('urust tool', function () {
if (!fs.existsSync(zipfile)) return this.skip();
// /rs8/<module>.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) {