-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine CI on to enable WERROR and test on emcc
- Loading branch information
1 parent
5a7adc1
commit abe3632
Showing
14 changed files
with
1,472 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function add(a: v128, b: v128): v128 { | ||
return v128.add<i32>(a, b); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module | ||
(type $v128_v128_=>_v128 (func (param v128 v128) (result v128))) | ||
(memory $0 0) | ||
(table $0 1 funcref) | ||
(export "memory" (memory $0)) | ||
(export "add" (func $tests/assembly/module-features/add)) | ||
(func $tests/assembly/module-features/add (; 0 ;) (param $0 v128) (param $1 v128) (result v128) | ||
local.get $0 | ||
local.get $1 | ||
i32x4.add | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function add(a: i32, b: i32): i32 { | ||
return a + b; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module | ||
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) | ||
(memory $0 0) | ||
(table $0 1 funcref) | ||
(export "memory" (memory $0)) | ||
(export "add" (func $tests/assembly/module/add)) | ||
(func $tests/assembly/module/add (; 0 ;) (param $0 i32) (param $1 i32) (result i32) | ||
local.get $0 | ||
local.get $1 | ||
i32.add | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../../node_modules/assemblyscript/std/assembly.json", | ||
"include": [ | ||
"./**/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
"use strict" | ||
var fs = require("fs"); | ||
var test = require("tape"); | ||
|
||
// This test case exists to catch the most obvious issues before pushing the binary back to GitHub. | ||
// It's not intended to be a full test suite, but feel free to extend it / send a PR if necessary! | ||
|
||
require("../../emscripten/libwabt")().then(wabt => { | ||
|
||
var mod; | ||
test("loading a binary module", function (test) { | ||
var buffer = new Uint8Array( | ||
fs.readFileSync(__dirname + "/assembly/module.wasm") | ||
); | ||
test.doesNotThrow(function () { | ||
mod = wabt.readWasm(buffer, { readDebugNames: true }); | ||
}); | ||
test.ok(mod && typeof mod.toBinary === "function", "should return a module"); | ||
test.end(); | ||
}); | ||
|
||
test("loading a binary module (with features)", function (test) { | ||
var buffer = new Uint8Array( | ||
fs.readFileSync(__dirname + "/assembly/module-features.wasm") | ||
); | ||
test.doesNotThrow(function () { | ||
mod = wabt.readWasm(buffer, { | ||
readDebugNames: true, | ||
}); | ||
}); | ||
test.ok(mod && typeof mod.toBinary === "function", "should return a module"); | ||
test.end(); | ||
}); | ||
|
||
test("modifying a module", function (test) { | ||
test.doesNotThrow(function () { | ||
mod.generateNames(); | ||
mod.applyNames(); | ||
}); | ||
test.end(); | ||
}); | ||
|
||
test("emitting a module", function (test) { | ||
var text, binaryRes; | ||
test.doesNotThrow(function () { | ||
text = mod.toText({ foldExprs: true, inlineExport: false }); | ||
binaryRes = mod.toBinary({ write_debug_names: true }); | ||
}); | ||
test.ok( | ||
typeof text === "string" && text.length, | ||
"should return a string from calling Module#toText" | ||
); | ||
test.ok( | ||
binaryRes && | ||
binaryRes.buffer && | ||
binaryRes.buffer.length && | ||
typeof binaryRes.log === "string", | ||
"should return a binary result from calling Module#toBinary" | ||
); | ||
test.end(); | ||
}); | ||
|
||
test("destroying a module", function (test) { | ||
test.doesNotThrow(function () { | ||
mod.destroy(); | ||
}, "should not throw when calling Module#destroy"); | ||
test.end(); | ||
}); | ||
|
||
test("loading a text (wat) module", function (test) { | ||
var str = fs.readFileSync(__dirname + "/assembly/module.wat").toString(); | ||
var mod; | ||
test.doesNotThrow(function () { | ||
mod = wabt.parseWat("module.wat", str); | ||
}); | ||
test.ok(mod && typeof mod.toBinary === "function", "should return a module"); | ||
test.doesNotThrow(function () { | ||
mod.destroy(); | ||
}, "should not throw when calling Module#destroy"); | ||
test.end(); | ||
}); | ||
|
||
test("loading a text (wat) module with features", function (test) { | ||
var str = fs.readFileSync(__dirname + "/assembly/module-features.wat").toString(); | ||
var mod; | ||
test.doesNotThrow(function () { | ||
mod = wabt.parseWat("module-features.wat", str); | ||
}); | ||
test.ok(mod && typeof mod.toBinary === "function", "should return a module"); | ||
test.doesNotThrow(function () { | ||
mod.destroy(); | ||
}, "should not throw when calling Module#destroy"); | ||
test.end(); | ||
}); | ||
|
||
}); |
Oops, something went wrong.