Skip to content

Commit 0161d35

Browse files
authored
Add test for ES6 + pthread + node (#20939)
We did not test ES6 in node before, only in the browser.
1 parent 388bcce commit 0161d35

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_other.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,21 @@ def test_export_es6_allows_export_in_post_js(self):
400400
src = read_file('a.out.js')
401401
self.assertContained('export{doNothing};', src)
402402

403+
@parameterized({
404+
'': ([],),
405+
'pthreads': (['-pthread'],),
406+
})
407+
def test_export_es6(self, args):
408+
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6',
409+
'-o', 'hello.mjs'] + args)
410+
# In ES6 mode we use MODULARIZE, so we must instantiate an instance of the
411+
# module to run it.
412+
create_file('runner.mjs', '''
413+
import Hello from "./hello.mjs";
414+
Hello();
415+
''')
416+
self.assertContained('hello, world!', self.run_js('runner.mjs'))
417+
403418
def test_emcc_out_file(self):
404419
# Verify that "-ofile" works in addition to "-o" "file"
405420
self.run_process([EMCC, '-c', '-ofoo.o', test_file('hello_world.c')])

0 commit comments

Comments
 (0)