Open
Description
Still early here, but might be nice to add testing at some point.
One option is to check output .wast
files for identity.
Another is to also execute them, for example, testing that fibonacci(5) has the right output. This is actually not that hard, we need to
- Add imports for testing prints,
(import $print_i32 "spectest" "print" (param i32))
for printing ani32
, for example. Thespectest
module is a special module that is supported in wasm test runners (it won't be supported on the web, but could be polyfilled). - Call the import using
call_import
to print values. - Add a
start
method (BinaryenSetStart
), avoid(void)
function that is called when the module is loaded. - Execute that webassembly using the binaryen shell, which should already be present since we build binaryen. Something like
binaryen-shell test.wast
will load the module and run the start method. - Verify the output is as expected.
Metadata
Metadata
Assignees
Labels
No labels