MikeInnes/Charlotte.jl

Testing

Opened this issue · 1 comments

Testing is tricking. This issue is for opening discussion on the topic.

One option is to use NodeJS.jl to run scripts compile to wasm. We'd need some JavaScript glue. I'm not sure where the test would actually take place and how it would propagate back to Julia.

Another option that looks like it's aimed at testing is WAVM.

As far as API, we could have an @jstest macro. It could work like @test where it tests an equality:

@jstest  myfun(a, b) == 3

Another option is just to return a result and have that compared to Julia's result. That would look like:

@jstest  myfun(a, b)

The round-trip time might be rather long, so we might need to compile/run tests in batches.

My hope is that we can just use MikeInnes/WebAssembly.jl#3 for this. The reference interpreter should be simple enough that once it conforms to the spec, things aren't going to go wrong easily. Then we can compare Julia/WASM output easily in-process.

Might still be useful to use nodejs for some more complex things, integration tests etc, but I hope that can fill the basic need for now.