diff options
Diffstat (limited to 'test/unit/test_features.py')
-rw-r--r-- | test/unit/test_features.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 6156191a2..afb873d30 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -137,6 +137,13 @@ class TargetFeaturesSectionTest(BinaryenTestCase): self.check_features(filename, ['nontrapping-float-to-int']) self.assertIn('i32.trunc_sat_f32_u', self.disassemble(filename)) + def test_mutable_globals(self): + filename = 'mutable_globals_target_feature.wasm' + self.roundtrip(filename) + self.check_features(filename, ['mutable-globals']) + self.assertIn('(import "env" "global-mut" (global $gimport$0 (mut i32)))', + self.disassemble(filename)) + def test_sign_ext(self): filename = 'signext_target_feature.wasm' self.roundtrip(filename) @@ -173,3 +180,20 @@ class TargetFeaturesSectionTest(BinaryenTestCase): def test_explicit_detect_features(self): self.check_features('signext_target_feature.wasm', ['sign-ext', 'simd'], opts=['-mvp', '--detect-features', '--enable-simd']) + + def test_emit_all_features(self): + p = run_process(WASM_OPT + ['--emit-target-features', '-all', '-o', '-'], + input="(module)", check=False, capture_output=True) + self.assertEqual(p.returncode, 0) + p2 = run_process(WASM_OPT + ['--print-features', '-o', os.devnull], + input=p.stdout, check=False, capture_output=True) + self.assertEqual(p2.returncode, 0) + self.assertEqual(p2.stdout.split(), [ + '--enable-threads', + '--enable-bulk-memory', + '--enable-exception-handling', + '--enable-mutable-globals', + '--enable-nontrapping-float-to-int', + '--enable-sign-ext', + '--enable-simd', + ]) |