@@ -5429,28 +5429,29 @@ def test_no_browser(self):
5429
5429
proc .terminate ()
5430
5430
proc .wait ()
5431
5431
5432
+ def test_program_arg_separator (self ):
5433
+ # Verify that trying to pass argument to the page without the `--` separator will
5434
+ # generate an actionable error message
5435
+ err = self .expect_fail ([EMRUN , '--foo' ])
5436
+ self .assertContained ('error: unrecognized arguments: --foo' , err )
5437
+ self .assertContained ('remember to add `--` between arguments' , err )
5438
+
5432
5439
def test_emrun (self ):
5433
- self .run_process ([ EMCC , test_file ('test_emrun.c' ), '--emrun' , '-o' , 'hello_world .html' ])
5440
+ self .emcc ( test_file ('test_emrun.c' ), [ '--emrun' , '-o' , 'test_emrun .html' ])
5434
5441
if not has_browser ():
5435
5442
self .skipTest ('need a browser' )
5436
5443
5437
5444
# We cannot run emrun from the temp directory the suite will clean up afterwards, since the
5438
5445
# browser that is launched will have that directory as startup directory, and the browser will
5439
5446
# not close as part of the test, pinning down the cwd on Windows and it wouldn't be possible to
5440
5447
# delete it. Therefore switch away from that directory before launching.
5441
-
5442
5448
os .chdir (path_from_root ())
5449
+
5443
5450
args_base = [EMRUN , '--timeout' , '30' , '--safe_firefox_profile' ,
5444
5451
'--kill-exit' , '--port' , '6939' , '--verbose' ,
5445
5452
'--log-stdout' , self .in_dir ('stdout.txt' ),
5446
5453
'--log-stderr' , self .in_dir ('stderr.txt' )]
5447
5454
5448
- # Verify that trying to pass argument to the page without the `--` separator will
5449
- # generate an actionable error message
5450
- err = self .expect_fail (args_base + ['--foo' ])
5451
- self .assertContained ('error: unrecognized arguments: --foo' , err )
5452
- self .assertContained ('remember to add `--` between arguments' , err )
5453
-
5454
5455
if EMTEST_BROWSER is not None :
5455
5456
# If EMTEST_BROWSER carried command line arguments to pass to the browser,
5456
5457
# (e.g. "firefox -profile /path/to/foo") those can't be passed via emrun,
@@ -5470,13 +5471,13 @@ def test_emrun(self):
5470
5471
args_base += ['--browser_args' , ' ' + ' ' .join (browser_args )]
5471
5472
5472
5473
for args in [
5473
- args_base ,
5474
- args_base + ['--port' , '0' ],
5475
- args_base + ['--private_browsing' , '--port' , '6941' ],
5476
- args_base + ['--dump_out_directory' , 'other dir/multiple' , '--port' , '6942' ],
5477
- args_base + ['--dump_out_directory=foo_bar' , '--port' , '6942' ],
5474
+ [] ,
5475
+ ['--port' , '0' ],
5476
+ ['--private_browsing' , '--port' , '6941' ],
5477
+ ['--dump_out_directory' , 'other dir/multiple' , '--port' , '6942' ],
5478
+ ['--dump_out_directory=foo_bar' , '--port' , '6942' ],
5478
5479
]:
5479
- args += [self .in_dir ('hello_world .html' ), '--' , '1' , '2' , '--3' , 'escaped space' , 'with_underscore' ]
5480
+ args = args_base + args + [self .in_dir ('test_emrun .html' ), '--' , '1' , '2' , '--3' , 'escaped space' , 'with_underscore' ]
5480
5481
print (shared .shlex_join (args ))
5481
5482
proc = self .run_process (args , check = False )
5482
5483
self .assertEqual (proc .returncode , 100 )
0 commit comments