summaryrefslogtreecommitdiff
path: root/test/example/cpp-unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/cpp-unit.cpp')
-rw-r--r--test/example/cpp-unit.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/example/cpp-unit.cpp b/test/example/cpp-unit.cpp
index 2aedfd441..9552473ce 100644
--- a/test/example/cpp-unit.cpp
+++ b/test/example/cpp-unit.cpp
@@ -556,10 +556,24 @@ void test_effects() {
assert_equal(EffectAnalyzer(options, features, &nop).trap, false);
}
+void test_literals() {
+ // The i31 heap type may or may not be basic, depending on if it is nullable.
+ // Verify we handle both code paths.
+ {
+ Literal x(Type(HeapType::i31, Nullable));
+ std::cout << x << '\n';
+ }
+ {
+ Literal x(Type(HeapType::i31, NonNullable));
+ std::cout << x << '\n';
+ }
+}
+
int main() {
test_bits();
test_cost();
test_effects();
+ test_literals();
if (failsCount > 0) {
abort();