diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/binaryen.js/expressions.js | 16 | ||||
-rw-r--r-- | test/heap-types.wast | 5 | ||||
-rw-r--r-- | test/heap-types.wast.from-wast | 21 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary | 21 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary.noDebugInfo | 21 |
5 files changed, 84 insertions, 0 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 6d4fa8011..3d2a5d138 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -1377,6 +1377,22 @@ console.log("# RefIs"); "(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(); })(); diff --git a/test/heap-types.wast b/test/heap-types.wast index da8baf1e0..614bbb1c5 100644 --- a/test/heap-types.wast +++ b/test/heap-types.wast @@ -182,4 +182,9 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if (ref.is_func (local.get $x)) (unreachable)) + (if (ref.is_data (local.get $x)) (unreachable)) + (if (ref.is_i31 (local.get $x)) (unreachable)) + ) ) diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index 33c86b903..b717de63f 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -196,4 +197,24 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if + (ref.is_func + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $x) + ) + (unreachable) + ) + ) ) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 2e1f25235..5b6dca2f6 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -195,5 +196,25 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if + (ref.is_func + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $x) + ) + (unreachable) + ) + ) ) diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo index beb9732a1..fef210e11 100644 --- a/test/heap-types.wast.fromBinary.noDebugInfo +++ b/test/heap-types.wast.fromBinary.noDebugInfo @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -195,5 +196,25 @@ ) ) ) + (func $5 (param $0 anyref) + (if + (ref.is_func + (local.get $0) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $0) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $0) + ) + (unreachable) + ) + ) ) |