diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2024-03-06 12:39:07 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2024-03-11 09:36:35 -0700 |
| commit | 7141379559e2ef17e48dfbadc898581cd34bef6f (patch) | |
| tree | 626bcaef1d4ed48bb18c8ebb63851ba2e4db6be9 /tests/run-make/wasm-custom-section/foo.js | |
| parent | d255c6a57c393db6221b1ff700daea478436f1cd (diff) | |
| download | rust-7141379559e2ef17e48dfbadc898581cd34bef6f.tar.gz rust-7141379559e2ef17e48dfbadc898581cd34bef6f.zip | |
Convert some WebAssembly run-make tests to Rust
This commit rewrites a number of `run-make` tests centered around wasm to instead use `rmake.rs` and additionally use the `wasm32-wasip1` target instead of `wasm32-unknown-unknown`. Testing no longer requires Node.js and additionally uses the `wasmparser` crate from crates.io to parse outputs and power assertions.
Diffstat (limited to 'tests/run-make/wasm-custom-section/foo.js')
| -rw-r--r-- | tests/run-make/wasm-custom-section/foo.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/run-make/wasm-custom-section/foo.js b/tests/run-make/wasm-custom-section/foo.js deleted file mode 100644 index 57a0f50732d..00000000000 --- a/tests/run-make/wasm-custom-section/foo.js +++ /dev/null @@ -1,36 +0,0 @@ -const fs = require('fs'); -const process = require('process'); -const assert = require('assert'); -const buffer = fs.readFileSync(process.argv[2]); - -let m = new WebAssembly.Module(buffer); -let sections = WebAssembly.Module.customSections(m, "baz"); -console.log('section baz', sections); -assert.strictEqual(sections.length, 1); -let section = new Uint8Array(sections[0]); -console.log('contents', section); -assert.strictEqual(section.length, 2); -assert.strictEqual(section[0], 7); -assert.strictEqual(section[1], 8); - -sections = WebAssembly.Module.customSections(m, "bar"); -console.log('section bar', sections); -assert.strictEqual(sections.length, 1, "didn't pick up `bar` section from dependency"); -section = new Uint8Array(sections[0]); -console.log('contents', section); -assert.strictEqual(section.length, 2); -assert.strictEqual(section[0], 3); -assert.strictEqual(section[1], 4); - -sections = WebAssembly.Module.customSections(m, "foo"); -console.log('section foo', sections); -assert.strictEqual(sections.length, 1, "didn't create `foo` section"); -section = new Uint8Array(sections[0]); -console.log('contents', section); -assert.strictEqual(section.length, 4, "didn't concatenate `foo` sections"); -assert.strictEqual(section[0], 5); -assert.strictEqual(section[1], 6); -assert.strictEqual(section[2], 1); -assert.strictEqual(section[3], 2); - -process.exit(0); |
