spec icon indicating copy to clipboard operation
spec copied to clipboard

Should there be a special case in assert_return for ref.null in the JS spec harness?

Open ddegazio opened this issue 1 year ago • 1 comments

On the wasm-3.0 branch, there's a few cases in the spec tests where an assert_return expects to get a ref.null, like in this test from select.wast:

(assert_return (invoke "join-funcnull" (i32.const 0)) (ref.null))

Compiling to JS, this produces:

assert_return(() => call($1, "join-funcnull", [0]), "ref.null");

Other special patterns, like NaNs or "ref.func", have special handling in the test harness so that we don't literally compare against the string "ref.func" or otherwise. For "ref.null" though, there is no such case, so returning JS null from join-funcnull (which as far as I can tell is correct per the JS API spec?) seems to fail the test. Is this intended somehow? Or is the harness just missing another case that checks for JS null values?

ddegazio avatar Aug 20 '24 23:08 ddegazio

Yes, this appears to be an oversight. Would you be interested in creating a PR to fix it?

rossberg avatar Aug 28 '24 11:08 rossberg

Okay, I ported the internal test harness to sync/async, which had been out of date. This should work now, please let me know if there still are problems.

rossberg avatar Sep 06 '24 09:09 rossberg