Skip to content

Commit 656bd5c

Browse files
authored
Use EM_JS instead of EM_ASM in other.test_js_optimizer_parse_error [NFC] (#19702)
EM_ASM ends up with an index which is the address of a string constant, which depends on other string constants in the program, for which reason it did not just pass in WasmFS. I realized the simple solution is to just use EM_JS there: that emits a nice simple JS function in which the parse error we look for occurs.
1 parent 0a78042 commit 656bd5c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/test_other.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9074,19 +9074,16 @@ def test_js_optimizer_parse_error(self):
90749074
# check we show a proper understandable error for JS parse problems
90759075
create_file('src.c', r'''
90769076
#include <emscripten.h>
9077+
EM_JS(void, js, (void), {
9078+
var x = !<->5.; // wtf... this will error on the '<'
9079+
});
90779080
int main() {
9078-
EM_ASM({
9079-
var x = !<->5.; // wtf
9080-
});
9081+
js();
90819082
}
90829083
''')
90839084
stderr = self.expect_fail([EMCC, 'src.c', '-O2'] + self.get_emcc_args())
9084-
# TODO: To make this test work in WasmFS, the constant below must be
9085-
# modified. It is the address in memory of the string constant of the
9086-
# EM_ASM, and WasmFS has its own string constants that cause a
9087-
# difference.
90889085
self.assertContained(('''
9089-
1024: () => { var x = !<->5.; }
9086+
function js() { var x = !<->5.; }
90909087
^
90919088
'''), stderr)
90929089

0 commit comments

Comments
 (0)