From 4965b2537a8a6700e3e12fda9c97e3c84d1d5796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Thu, 12 Oct 2017 20:48:07 +0300 Subject: [PATCH] Add test case for the failing scenario where file is loaded from a relative path. --- tests/test_other.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_other.py b/tests/test_other.py index efd9dcb829a6b..58140c8ef9b15 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -7927,3 +7927,10 @@ def test_include_system_header_in_c(self): print inc open('a.c', 'w').write(inc) subprocess.check_call([PYTHON, EMCC, '-std=c89', 'a.c']) + + # Tests that Emscripten-compiled applications can be run from a relative path with node command line that is different than the current working directory. + def test_node_js_run_from_different_directory(self): + os.mkdir('subdir') + Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-o', os.path.join('subdir', 'a.js'), '-O3']).communicate() + ret = Popen(NODE_JS + [os.path.join('subdir', 'a.js')], stdout=PIPE).communicate()[0] + assert 'hello, world!' in ret