summaryrefslogtreecommitdiff
path: root/test/unit/test_features.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_features.py')
-rw-r--r--test/unit/test_features.py44
1 files changed, 39 insertions, 5 deletions
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 506fd8809..2b5b00469 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -42,8 +42,17 @@ class FeatureValidationTest(utils.BinaryenTestCase):
self.check_feature(module, error, '--enable-reference-types')
def check_multivalue(self, module, error):
+ self.check_feature(module, error, '--enable-multivalue')
+
+ def check_multivalue_exception_handling(self, module, error):
self.check_feature(module, error, '--enable-multivalue',
- ['--enable-exception-handling'])
+ ['--enable-exception-handling',
+ '--enable-reference-types'])
+
+ def check_anyref(self, module, error):
+ # Anyref handling implies reference types
+ self.check_feature(module, error, '--enable-anyref',
+ ['--enable-reference-types'])
def test_v128_signature(self):
module = '''
@@ -228,8 +237,8 @@ class FeatureValidationTest(utils.BinaryenTestCase):
(event $foo (attr 0) (param i32 i64))
)
'''
- self.check_multivalue(module, 'Multivalue event type ' +
- '(multivalue is not enabled)')
+ self.check_multivalue_exception_handling(module, 'Multivalue event type ' +
+ '(multivalue is not enabled)')
def test_multivalue_block(self):
module = '''
@@ -249,6 +258,24 @@ class FeatureValidationTest(utils.BinaryenTestCase):
self.check_multivalue(module, 'Multivalue block type ' +
'(multivalue is not enabled)')
+ def test_anyref_global(self):
+ module = '''
+ (module
+ (global $foo anyref (ref.null any))
+ )
+ '''
+ self.check_anyref(module, 'all used types should be allowed')
+
+ def test_anyref_local(self):
+ module = '''
+ (module
+ (func $foo
+ (local $0 anyref)
+ )
+ )
+ '''
+ self.check_anyref(module, 'all used types should be allowed')
+
class TargetFeaturesSectionTest(utils.BinaryenTestCase):
def test_atomics(self):
@@ -303,9 +330,15 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase):
def test_exception_handling(self):
filename = 'exception_handling_target_feature.wasm'
self.roundtrip(filename)
- self.check_features(filename, ['exception-handling'])
+ self.check_features(filename, ['exception-handling', 'reference-types'])
self.assertIn('throw', self.disassemble(filename))
+ def test_anyref(self):
+ filename = 'anyref_target_feature.wasm'
+ self.roundtrip(filename)
+ self.check_features(filename, ['reference-types', 'anyref'])
+ self.assertIn('anyref', self.disassemble(filename))
+
def test_incompatible_features(self):
path = self.input_path('signext_target_feature.wasm')
p = shared.run_process(
@@ -353,5 +386,6 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase):
'--enable-exception-handling',
'--enable-tail-call',
'--enable-reference-types',
- '--enable-multivalue'
+ '--enable-multivalue',
+ '--enable-anyref'
], p2.stdout.splitlines())