test
diff --git a/tests/test_other.py b/tests/test_other.py index 0a5a84f..904bb1d 100644 --- a/tests/test_other.py +++ b/tests/test_other.py
@@ -5564,6 +5564,24 @@ self.assertNotEqual(result.returncode, 0) self.assertContained('Customizing EXPORT_NAME requires that the HTML be customized to use that name', result.stdout) + def test_modularize_code_caching(self): + create_test_file('extern-post.js', ''' + var original = WebAssembly.Module; + var total = 0; + WebAssembly.Module = function(code) { + console.log('compile a new Module'); + total++; + return new original(code); + }; + for (var i = 0; i < 10; i++) { + console.log(i); + Module(); + } + console.log('total Module creations', total, '.'); + ''') + run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'MODULARIZE=1', '-s', 'WASM_ASYNC_COMPILATION=0', '--extern-post-js', 'extern-post.js']) + self.assertContained('total Module creations 1 .', run_js('a.out.js')) + @no_wasm_backend('tests fastcomp specific passes') def test_emcc_c_multi(self): def test(args, llvm_opts=None):