Skip to content

Commit

Permalink
failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jul 12, 2024
1 parent 45bdc55 commit 7c5cb0e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions crates/spidermonkey-embedding-splicer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ impl Guest for SpidermonkeyEmbeddingSplicerComponent {
}

// println!("{:?}", &componentized.imports);
// println!("{:?}", &componentized.resource_imports);
// println!("{:?}", &exports);
let mut wasm =
splice::splice(engine, imports, exports, debug).map_err(|e| format!("{:?}", e))?;
Expand Down
1 change: 1 addition & 0 deletions src/componentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,6 @@ export async function componentize(jsSource, witWorld, opts) {
return {
component,
imports,
exports: exports.map(([name]) => name)
};
}
3 changes: 0 additions & 3 deletions test/cases/smoke/imports.js

This file was deleted.

8 changes: 2 additions & 6 deletions test/cases/smoke/source.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { y } from 'imports';

export const exports = {
hello () {
export function unusedHello () {
return 'world (' + getNum('world') + ')';
}
};
}
6 changes: 4 additions & 2 deletions test/cases/smoke/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ok } from 'node:assert';
import { ok, strictEqual } from 'node:assert';

export function test (instance) {
export function test (instance, { imports, exports }) {
strictEqual(imports.length, 0);
strictEqual(exports.length, 0);
ok(instance);
}
10 changes: 6 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ suite('Builtins', () => {
disableFeatures,
} = await import(`./builtins/${filename}`);

const { component, imports } = await componentize(
const { component } = await componentize(
source,
`
package local:runworld;
Expand Down Expand Up @@ -141,14 +141,16 @@ suite('Bindings', () => {

const test = await import(`./cases/${name}/test.js`);

let testArg;
try {
const { component, imports } = await componentize(source, {
const { component, imports, exports } = await componentize(source, {
sourceName: `${name}.js`,
witWorld,
witPath,
worldName,
disableFeatures: isWasiTarget ? [] : ['random', 'clocks']
disableFeatures: isWasiTarget ? [] : ['random', 'clocks', 'http', 'stdio']
});
testArg = { imports, exports };

const map = {
'wasi:cli-base/*': '@bytecodealliance/preview2-shim/cli-base#*',
Expand Down Expand Up @@ -200,7 +202,7 @@ suite('Bindings', () => {
}
throw e;
}
await test.test(instance);
await test.test(instance, testArg);
});
}
});
Expand Down

0 comments on commit 7c5cb0e

Please sign in to comment.