summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
Diffstat (limited to 'test/example')
-rw-r--r--test/example/c-api-kitchen-sink.c14
-rw-r--r--test/example/c-api-kitchen-sink.txt7
2 files changed, 21 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 5db1d28dc..894fc1454 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -1012,6 +1012,20 @@ void test_core() {
BinaryenAddPassiveElementSegment(module, "p2", funcNames, 1);
BinaryenRemoveElementSegment(module, "p2");
+ BinaryenExpressionRef funcrefExpr1 =
+ BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref());
+
+ BinaryenExpressionPrint(BinaryenTableSet(
+ module, "0", BinaryenConst(module, BinaryenLiteralInt32(0)), funcrefExpr1));
+
+ BinaryenExpressionRef funcrefExpr2 =
+ BinaryenTableGet(module,
+ "0",
+ BinaryenConst(module, BinaryenLiteralInt32(0)),
+ BinaryenTypeFuncref());
+
+ BinaryenExpressionPrint(funcrefExpr2);
+
// Memory. One per module
const char* segments[] = {"hello, world", "I am passive"};
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 3372ba8b6..c28e0536d 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -31,6 +31,13 @@ BinaryenFeatureAll: 32767
(f32.neg
(f32.const -33.61199951171875)
)
+(table.set $0
+ (i32.const 0)
+ (ref.func "$kitchen()sinker")
+)
+(table.get $0
+ (i32.const 0)
+)
(module
(type $i32_i64_f32_f64_=>_i32 (func (param i32 i64 f32 f64) (result i32)))
(type $i32_=>_none (func (param i32)))