Testing wasm using wasmtime

Currently, the wasm tests are written in JS with jest. While that is a viable option, one of the main points of wasm is to be fast and small, unlike the behemoth called jest used for testing. What we could do is leverage wasmtime together with an assertion library written in web assembly itself.

I am currently preparing such an assertion library just for the fun of it. It can currently make boolean assertions and assertions about i32/i64 including formatted output. There are other formats on my TODO list as well as a handler to show the overall stats and put out an exit code.

A test would then look like this:

(module
  (import "watest" "memory" (memory 1))
  (import "watest" "assert_bool" (func $assert_bool (param i32 i32 i32))
  (import "watest" "stats" (func $stats))

  (data (i32.const 0) "Testing works")

  (func (export "test")
    (call $assert_bool (i32.const 1) (i32.const 0) (i32.const 13))
    (call $stats)
  )
)

Do you like this idea or is that stupid?