Skip to content

Commit

Permalink
Add test for ES6 + pthread + node (#20939)
Browse files Browse the repository at this point in the history
We did not test ES6 in node before, only in the browser.
  • Loading branch information
kripken authored Dec 19, 2023
1 parent 388bcce commit 0161d35
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,21 @@ def test_export_es6_allows_export_in_post_js(self):
src = read_file('a.out.js')
self.assertContained('export{doNothing};', src)

@parameterized({
'': ([],),
'pthreads': (['-pthread'],),
})
def test_export_es6(self, args):
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6',
'-o', 'hello.mjs'] + args)
# In ES6 mode we use MODULARIZE, so we must instantiate an instance of the
# module to run it.
create_file('runner.mjs', '''
import Hello from "./hello.mjs";
Hello();
''')
self.assertContained('hello, world!', self.run_js('runner.mjs'))

def test_emcc_out_file(self):
# Verify that "-ofile" works in addition to "-o" "file"
self.run_process([EMCC, '-c', '-ofoo.o', test_file('hello_world.c')])
Expand Down

0 comments on commit 0161d35

Please sign in to comment.