summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
Diffstat (limited to 'test/example')
-rw-r--r--test/example/c-api-kitchen-sink.c5
-rw-r--r--test/example/c-api-kitchen-sink.txt19
2 files changed, 24 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 09a6897eb..118fcb3f3 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -312,6 +312,7 @@ void test_core() {
BinaryenExpressionRef funcrefExpr = BinaryenRefNull(module, BinaryenTypeFuncref());
funcrefExpr = BinaryenRefFunc(module, "kitchen()sinker");
BinaryenExpressionRef exnrefExpr = BinaryenRefNull(module, BinaryenTypeExnref());
+ BinaryenExpressionRef i31refExpr = BinaryenI31New(module, makeInt32(module, 1));
// Events
BinaryenAddEvent(
@@ -776,6 +777,10 @@ void test_core() {
// Memory
BinaryenMemorySize(module),
BinaryenMemoryGrow(module, makeInt32(module, 0)),
+ // GC
+ BinaryenI31New(module, makeInt32(module, 0)),
+ BinaryenI31Get(module, i31refExpr, 1),
+ BinaryenI31Get(module, BinaryenI31New(module, makeInt32(module, 2)), 0),
// Other
BinaryenNop(module),
BinaryenUnreachable(module),
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 29ead874f..fe951cdcc 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1874,6 +1874,25 @@ BinaryenFeatureAll: 4095
(i32.const 0)
)
)
+ (drop
+ (i31.new
+ (i32.const 0)
+ )
+ )
+ (drop
+ (i31.get_s
+ (i31.new
+ (i32.const 1)
+ )
+ )
+ )
+ (drop
+ (i31.get_u
+ (i31.new
+ (i32.const 2)
+ )
+ )
+ )
(nop)
(unreachable)
)