@@ -2850,21 +2850,19 @@ def test_get_proc_address_error_message(self):
28502850  })
28512851  def test_prepost(self, no_initial_run, run_dep):
28522852    create_file('pre.js', '''
2853-       var  Module = {
2854-         preRun: () => out('pre-run'),
2855-         postRun: () => out('post-run')
2853+       Module = {
2854+         " preRun" : () => out('pre-run'),
2855+         " postRun" : () => out('post-run')
28562856      };
28572857      ''')
28582858
2859-     self.run_process([EMCC, test_file('hello_world.c'), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0'])
2860-     self.assertContained('pre-run\nhello, world!\npost-run\n', self.run_js('a.out.js'))
2859+     self.do_runf('hello_world.c', 'pre-run\nhello, world!\npost-run\n', cflags=['--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0'])
28612860
28622861    # addRunDependency during preRun should prevent main, and post-run from
28632862    # running.
28642863    with open('pre.js', 'a') as f:
2865-       f.write('Module.preRun = () => { out("add-dep"); addRunDependency(); }\n')
2866-     self.run_process([EMCC, test_file('hello_world.c'), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0'])
2867-     output = self.run_js('a.out.js')
2864+       f.write('Module["preRun"] = () => { out("add-dep"); addRunDependency("dep"); }\n')
2865+     output = self.do_runf('hello_world.c', cflags=['--pre-js', 'pre.js', '-sRUNTIME_DEBUG', '-sWASM_ASYNC_COMPILATION=0', '-O2', '--closure=1'])
28682866    self.assertContained('add-dep\n', output)
28692867    self.assertNotContained('hello, world!\n', output)
28702868    self.assertNotContained('post-run\n', output)
@@ -2874,21 +2872,20 @@ def test_prepost(self, no_initial_run, run_dep):
28742872    if no_initial_run:
28752873      args += ['-sINVOKE_RUN=0']
28762874    if run_dep:
2877-       create_file('pre.js', 'Module. preRun = () => addRunDependency("test");')
2875+       create_file('pre.js', 'Module[" preRun"]  = () => addRunDependency("test");')
28782876      create_file('post.js', 'removeRunDependency("test");')
28792877      args += ['--pre-js', 'pre.js', '--post-js', 'post.js']
28802878
2881-     self.run_process([EMCC, test_file('hello_world.c')] + args)
2882-     output = self.run_js('a.out.js')
2879+     output = self.do_runf('hello_world.c', cflags=args)
28832880    self.assertContainedIf('hello, world!', output, not no_initial_run)
28842881
28852882    if no_initial_run:
28862883      # Calling main later should still work, filesystem etc. must be set up.
28872884      print('call main later')
2888-       src = read_file('a.out .js')
2885+       src = read_file('hello_world .js')
28892886      src += '\nout("callMain -> " + Module.callMain());\n'
2890-       create_file('a.out .js', src)
2891-       self.assertContained('hello, world!\ncallMain -> 0\n', self.run_js('a.out .js'))
2887+       create_file('hello_world .js', src)
2888+       self.assertContained('hello, world!\ncallMain -> 0\n', self.run_js('hello_world .js'))
28922889
28932890  def test_prepost2(self):
28942891    create_file('pre.js', 'Module.preRun = () => out("pre-run");')
0 commit comments