| //@ skip |
| |
| function shouldBe(actual, expected) { |
| if (actual !== expected) |
| throw new Error('bad value: ' + actual); |
| } |
| |
| /* |
| wasm/comma.wasm is generated by pack-asmjs <https://github.com/WebAssembly/polyfill-prototype-1> from the following script: |
| |
| function asmModule(global, env, buffer) { |
| "use asm"; |
| |
| var g = 0; |
| |
| function setG(x) { |
| x = x | 0; |
| g = x; |
| } |
| |
| function testComma1() { |
| return 1, 2, 3, 4; |
| } |
| |
| function testComma2() { |
| var x = 0.0; |
| return (x = x + 1.0), (x = x * 2.0), +x; |
| } |
| |
| function testComma3() { |
| return (g = 0), setG(42), (g | 0); |
| } |
| |
| return { |
| testComma1: testComma1, |
| testComma2: testComma2, |
| testComma3: testComma3, |
| }; |
| } |
| */ |
| |
| var module = loadWebAssembly("wasm/comma.wasm"); |
| |
| shouldBe(module.testComma1(), 4); |
| shouldBe(module.testComma2(), 2); |
| shouldBe(module.testComma3(), 42); |