Skip to content

Commit e367b93

Browse files
committed
add test cases for unused exports
1 parent 909a2ac commit e367b93

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
it("should allow wasm with unused exports", function() {
2+
return import("./module").then(function(module) {
3+
const result = module.run();
4+
expect(result).toEqual(42);
5+
});
6+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { getNumber } from "./wasm.wat";
2+
3+
export function run() {
4+
return getNumber();
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
2+
3+
module.exports = function(config) {
4+
return supportsWebAssembly();
5+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(module
2+
(type $t0 (func (param i32 i32) (result i32)))
3+
(type $t1 (func (result i32)))
4+
(func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32)
5+
(i32.add
6+
(get_local $p0)
7+
(get_local $p1)))
8+
(func $getNumber (export "getNumber") (type $t1) (result i32)
9+
(i32.const 42)))
10+

0 commit comments

Comments
 (0)