summaryrefslogtreecommitdiff
path: root/test/binaryen.js/expressions.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js/expressions.js')
-rw-r--r--test/binaryen.js/expressions.js53
1 files changed, 16 insertions, 37 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index c0bc402a0..ee55ee90b 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -1417,51 +1417,30 @@ console.log("# MemoryFill");
module.dispose();
})();
-console.log("# RefIs");
-(function testRefIs() {
+console.log("# RefIsNull");
+(function testRefIsNull() {
const module = new binaryen.Module();
- var op = binaryen.Operations.RefIsNull;
var value = module.local.get(1, binaryen.externref);
- const theRefIs = binaryen.RefIs(module.ref.is_null(value));
- assert(theRefIs instanceof binaryen.RefIs);
- assert(theRefIs instanceof binaryen.Expression);
- assert(theRefIs.op === op);
- assert(theRefIs.value === value);
- assert(theRefIs.type === binaryen.i32);
-
- theRefIs.op = op = binaryen.Operations.RefIsFunc;
- assert(theRefIs.op === op);
- theRefIs.op = op = binaryen.Operations.RefIsNull;
- theRefIs.value = value = module.local.get(2, binaryen.externref);
- assert(theRefIs.value === value);
- theRefIs.type = binaryen.f64;
- theRefIs.finalize();
- assert(theRefIs.type === binaryen.i32);
-
- console.log(theRefIs.toText());
+ const theRefIsNull = binaryen.RefIsNull(module.ref.is_null(value));
+ assert(theRefIsNull instanceof binaryen.RefIsNull);
+ assert(theRefIsNull instanceof binaryen.Expression);
+ assert(theRefIsNull.value === value);
+ assert(theRefIsNull.type === binaryen.i32);
+
+ theRefIsNull.value = value = module.local.get(2, binaryen.externref);
+ assert(theRefIsNull.value === value);
+ theRefIsNull.type = binaryen.f64;
+ theRefIsNull.finalize();
+ assert(theRefIsNull.type === binaryen.i32);
+
+ console.log(theRefIsNull.toText());
assert(
- theRefIs.toText()
+ theRefIsNull.toText()
==
"(ref.is_null\n (local.get $2)\n)\n"
);
- assert(
- binaryen.RefIs(module.ref.is_func(value)).toText()
- ==
- "(ref.is_func\n (local.get $2)\n)\n"
- );
- assert(
- binaryen.RefIs(module.ref.is_data(value)).toText()
- ==
- "(ref.is_data\n (local.get $2)\n)\n"
- );
- assert(
- binaryen.RefIs(module.ref.is_i31(value)).toText()
- ==
- "(ref.is_i31\n (local.get $2)\n)\n"
- );
-
module.dispose();
})();