]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/wasm-custom-sections-opt/foo.js
Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup
[rust.git] / src / test / run-make / wasm-custom-sections-opt / foo.js
1 const fs = require('fs');
2 const process = require('process');
3 const assert = require('assert');
4 const buffer = fs.readFileSync(process.argv[2]);
5
6 let m = new WebAssembly.Module(buffer);
7
8 sections = WebAssembly.Module.customSections(m, "foo");
9 console.log('section foo', sections);
10 assert.strictEqual(sections.length, 1, "didn't create `foo` section");
11 section = new Uint8Array(sections[0]);
12 console.log('contents', section);
13 assert.strictEqual(section.length, 4, "didn't concatenate `foo` sections");
14
15 process.exit(0);