mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-21 20:22:14 +00:00
Fix tests
This commit is contained in:
parent
23009dbc1e
commit
4f0ddd25ce
@ -1,11 +1,11 @@
|
|||||||
const strictEqual = require('assert').strictEqual;
|
const strictEqual = require('assert').strictEqual;
|
||||||
|
|
||||||
global.math = class {
|
global.mathtest = {};
|
||||||
powf(base, exp) {
|
|
||||||
|
global.mathtest.powf = function powf(base, exp) {
|
||||||
return Math.pow(base, exp);
|
return Math.pow(base, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_one(val) {
|
global.mathtest.add_one = function add_one(val) {
|
||||||
return val + 1;
|
return val + 1;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
@ -4,7 +4,7 @@ include!(concat!(env!("OUT_DIR"), "/namespace.rs"));
|
|||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn simple_namespace_test() {
|
fn simple_namespace_test() {
|
||||||
assert_eq!(math::add_one(1), 2);
|
assert_eq!(mathtest::add_one(1), 2);
|
||||||
assert_eq!(math::powf(1.0, 100.0), 1.0);
|
assert_eq!(mathtest::powf(1.0, 100.0), 1.0);
|
||||||
assert_eq!(math::powf(10.0, 2.0), 100.0);
|
assert_eq!(mathtest::powf(10.0, 2.0), 100.0);
|
||||||
}
|
}
|
||||||
|
2
crates/webidl-tests/namespace.webidl
vendored
2
crates/webidl-tests/namespace.webidl
vendored
@ -1,4 +1,4 @@
|
|||||||
namespace math {
|
namespace mathtest {
|
||||||
long add_one(long val);
|
long add_one(long val);
|
||||||
double powf(double base, double exponent);
|
double powf(double base, double exponent);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user