@@ -113,13 +113,13 @@ def also_with_wasmfs(f):
113
113
assert callable(f)
114
114
115
115
@wraps(f)
116
- def metafunc(self, wasmfs):
116
+ def metafunc(self, wasmfs, *args, **kwargs ):
117
117
if wasmfs:
118
118
self.set_setting('WASMFS')
119
119
self.emcc_args.append('-DWASMFS')
120
- f(self)
120
+ f(self, *args, **kwargs )
121
121
else:
122
- f(self)
122
+ f(self, *args, **kwargs )
123
123
124
124
parameterize(metafunc, {'': (False,),
125
125
'wasmfs': (True,)})
@@ -1642,32 +1642,31 @@ def test_export_all_and_exported_functions(self):
1642
1642
self.emcc('lib.c', ['-sEXPORTED_FUNCTIONS=_libfunc2', '-sEXPORT_ALL', '--pre-js', 'pre.js'], output_filename='a.out.js')
1643
1643
self.assertContained('libfunc\n', self.run_js('a.out.js'))
1644
1644
1645
+ @parameterized({
1646
+ '': ([],),
1647
+ 'closure': (['-O2', '--closure=1'],),
1648
+ })
1645
1649
@also_with_wasmfs
1646
1650
@crossplatform
1647
- def test_stdin(self):
1648
- def run_test():
1649
- for engine in config.JS_ENGINES:
1650
- if engine == config.V8_ENGINE:
1651
- continue # no stdin support in v8 shell
1652
- engine[0] = os.path.normpath(engine[0])
1653
- print(engine, file=sys.stderr)
1654
- # work around a bug in python's subprocess module
1655
- # (we'd use self.run_js() normally)
1656
- delete_file('out.txt')
1657
- cmd = jsrun.make_command(os.path.normpath('out.js'), engine)
1658
- cmd = shared.shlex_join(cmd)
1659
- if WINDOWS:
1660
- os.system(f'type "in.txt" | {cmd} >out.txt')
1661
- else: # posix
1662
- os.system(f'cat in.txt | {cmd} > out.txt')
1663
- self.assertContained('abcdef\nghijkl\neof', read_file('out.txt'))
1664
-
1665
- self.emcc(test_file('module/test_stdin.c'), output_filename='out.js')
1651
+ def test_stdin(self, args):
1666
1652
create_file('in.txt', 'abcdef\nghijkl')
1667
- run_test()
1668
- self.emcc(test_file('module/test_stdin.c'),
1669
- ['-O2', '--closure=1'], output_filename='out.js')
1670
- run_test()
1653
+ self.emcc(test_file('module/test_stdin.c'), args=args, output_filename='out.js')
1654
+
1655
+ for engine in config.JS_ENGINES:
1656
+ if engine == config.V8_ENGINE:
1657
+ continue # no stdin support in v8 shell
1658
+ engine[0] = os.path.normpath(engine[0])
1659
+ print(engine, file=sys.stderr)
1660
+ # work around a bug in python's subprocess module
1661
+ # (we'd use self.run_js() normally)
1662
+ delete_file('out.txt')
1663
+ cmd = jsrun.make_command(os.path.normpath('out.js'), engine)
1664
+ cmd = shared.shlex_join(cmd)
1665
+ if WINDOWS:
1666
+ os.system(f'type "in.txt" | {cmd} >out.txt')
1667
+ else: # posix
1668
+ os.system(f'cat in.txt | {cmd} > out.txt')
1669
+ self.assertContained('abcdef\nghijkl\neof', read_file('out.txt'))
1671
1670
1672
1671
def test_ungetc_fscanf(self):
1673
1672
create_file('main.c', r'''
0 commit comments