Skip to content

Commit

Permalink
add test cases for unused exports
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 28, 2018
1 parent 909a2ac commit e367b93
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/cases/wasm/unused-export/index.js
@@ -0,0 +1,6 @@
it("should allow wasm with unused exports", function() {
return import("./module").then(function(module) {
const result = module.run();
expect(result).toEqual(42);
});
});
5 changes: 5 additions & 0 deletions test/cases/wasm/unused-export/module.js
@@ -0,0 +1,5 @@
import { getNumber } from "./wasm.wat";

export function run() {
return getNumber();
}
5 changes: 5 additions & 0 deletions test/cases/wasm/unused-export/test.filter.js
@@ -0,0 +1,5 @@
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");

module.exports = function(config) {
return supportsWebAssembly();
};
10 changes: 10 additions & 0 deletions test/cases/wasm/unused-export/wasm.wat
@@ -0,0 +1,10 @@
(module
(type $t0 (func (param i32 i32) (result i32)))
(type $t1 (func (result i32)))
(func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32)
(i32.add
(get_local $p0)
(get_local $p1)))
(func $getNumber (export "getNumber") (type $t1) (result i32)
(i32.const 42)))

0 comments on commit e367b93

Please sign in to comment.