wasm-bindgen/tests/simple.rs
Alex Crichton d2d9f6be11 Avoid registry/git repo updates in tests
Use the main lockfile as a template, also print out how long each
command takes.
2017-12-14 19:36:41 -08:00

29 lines
683 B
Rust

extern crate test_support;
#[test]
fn add() {
test_support::project()
.file("src/lib.rs", r#"
#![feature(proc_macro)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
wasm_bindgen! {
pub fn add(a: u32, b: u32) -> u32 {
a + b
}
}
"#)
.file("test.js", r#"
import * as assert from "assert";
export function test(wasm) {
assert.strictEqual(wasm.instance.exports.add(1, 2), 3);
assert.strictEqual(wasm.instance.exports.add(2, 3), 5);
}
"#)
.test();
}