diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/cpp-unit.cpp | 14 | ||||
-rw-r--r-- | test/example/cpp-unit.txt | 2 |
2 files changed, 16 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(); diff --git a/test/example/cpp-unit.txt b/test/example/cpp-unit.txt index 35821117c..cbe80e119 100644 --- a/test/example/cpp-unit.txt +++ b/test/example/cpp-unit.txt @@ -1 +1,3 @@ +i31ref(0) +i31ref(0) Success |