Skip to content

Commit 1da9f3a

Browse files
authored
[test] Consistent naming of ES module tests. NFC (#23813)
Split out from #23175
1 parent 004d96c commit 1da9f3a

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

test/test_other.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def test_emcc_generate_config(self, compiler):
359359
'': ([],),
360360
'node': (['-sENVIRONMENT=node'],),
361361
})
362-
def test_emcc_output_mjs(self, args):
362+
def test_esm(self, args):
363363
self.run_process([EMCC, '-o', 'hello_world.mjs',
364364
'--extern-post-js', test_file('modularize_post_js.js'),
365365
test_file('hello_world.c')] + args)
@@ -372,7 +372,7 @@ def test_emcc_output_mjs(self, args):
372372
'node': (['-sENVIRONMENT=node'],),
373373
})
374374
@node_pthreads
375-
def test_emcc_output_worker_mjs(self, args):
375+
def test_esm_worker(self, args):
376376
os.mkdir('subdir')
377377
self.run_process([EMCC, '-o', 'subdir/hello_world.mjs',
378378
'-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '-O1',
@@ -385,7 +385,7 @@ def test_emcc_output_worker_mjs(self, args):
385385
self.assertContained('hello, world!', self.run_js('subdir/hello_world.mjs'))
386386

387387
@node_pthreads
388-
def test_emcc_output_worker_mjs_single_file(self):
388+
def test_esm_worker_single_file(self):
389389
self.run_process([EMCC, '-o', 'hello_world.mjs', '-pthread',
390390
'--extern-post-js', test_file('modularize_post_js.js'),
391391
test_file('hello_world.c'), '-sSINGLE_FILE'])
@@ -394,40 +394,23 @@ def test_emcc_output_worker_mjs_single_file(self):
394394
self.assertContained("new Worker(new URL('hello_world.mjs', import.meta.url), {", src)
395395
self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
396396

397-
def test_emcc_output_mjs_closure(self):
397+
def test_esm_closure(self):
398398
self.run_process([EMCC, '-o', 'hello_world.mjs',
399399
'--extern-post-js', test_file('modularize_post_js.js'),
400400
test_file('hello_world.c'), '--closure=1'])
401401
src = read_file('hello_world.mjs')
402402
self.assertContained('new URL("hello_world.wasm", import.meta.url)', src)
403403
self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
404404

405-
def test_export_es6_implies_modularize(self):
405+
def test_esm_implies_modularize(self):
406406
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6'])
407407
src = read_file('a.out.js')
408408
self.assertContained('export default Module;', src)
409409

410-
def test_export_es6_requires_modularize(self):
410+
def test_esm_requires_modularize(self):
411411
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sMODULARIZE=0'])
412412
self.assertContained('EXPORT_ES6 requires MODULARIZE to be set', err)
413413

414-
@parameterized({
415-
'': ([],),
416-
# load a worker before startup to check ES6 modules there as well
417-
'pthreads': (['-pthread', '-sPTHREAD_POOL_SIZE=1'],),
418-
})
419-
def test_export_es6(self, args):
420-
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6',
421-
'-o', 'hello.mjs'] + args)
422-
# In ES6 mode we use MODULARIZE, so we must instantiate an instance of the
423-
# module to run it.
424-
create_file('runner.mjs', '''
425-
import Hello from "./hello.mjs";
426-
Hello();
427-
''')
428-
429-
self.assertContained('hello, world!', self.run_js('runner.mjs'))
430-
431414
@parameterized({
432415
'': ([],),
433416
'pthreads': (['-pthread'],),

0 commit comments

Comments
 (0)