aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-29 13:38:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-29 13:38:49 -0700
commit82cafff17306df64c31224c1e343458a6096ff36 (patch)
tree63ade4fb328d26ec62fadac00964fedd61904403
parentc30c31661c0db498b2189faefa288da6ab30dfc0 (diff)
fix test_scriptaclass
-rw-r--r--src/shell.js4
-rwxr-xr-xtests/runner.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/shell.js b/src/shell.js
index 952f6899..2082eeae 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -9,6 +9,10 @@
// case, where this code here is minified but Module was defined
// elsewhere (e.g. case 4 above). We also need to check if Module
// already exists (e.g. case 3 above).
+// Note that if you want to run closure, and also to use Module
+// after the generated code, you will need to define var Module = {};
+// before the code. Then that object will be used in the code, and you
+// can continue to use Module afterwards as well.
var Module;
if (!Module) Module = eval('(function() { try { return {{{ EXPORT_NAME }}} || {} } catch(e) { return {} } })()');
diff --git a/tests/runner.py b/tests/runner.py
index 77f36cf5..1948ab59 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -9528,7 +9528,10 @@ def process(filename):
c2.virtualFunc2();
Module.print('*ok*');
'''
- src = open(filename, 'a')
+ code = open(filename).read()
+ src = open(filename, 'w')
+ src.write('var Module = {};\n') # name Module
+ src.write(code)
src.write(script_src_2 + '\n')
src.close()