aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-27 17:20:12 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-27 17:20:12 -0700
commite792dc4e6aea8bd4b95eada40f85e8c0598dfc3d (patch)
tree565fada0d7733fddeecdc0baa67cba3850f09374
parentafd5a42acfb5885bcb48aae1a5114396f5e54481 (diff)
fix ccall regex for minified code, and add testing
-rw-r--r--src/preamble.js2
-rw-r--r--tests/test_core.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/preamble.js b/src/preamble.js
index fbce6b6b..58b442ab 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -396,7 +396,7 @@ var cwrap, ccall;
return ret;
}
- var sourceRegex = /^function\s\((.*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
+ var sourceRegex = /^function\s\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
function parseJSFunc(jsfunc) {
// Match the body and the return value of a javascript function source
var parsed = jsfunc.toString().match(sourceRegex).slice(1);
diff --git a/tests/test_core.py b/tests/test_core.py
index 46d3964c..7e15f1b8 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -5453,9 +5453,6 @@ def process(filename):
### Integration tests
def test_ccall(self):
- if self.emcc_args is not None and '-O2' in self.emcc_args:
- self.emcc_args += ['--closure', '1'] # Use closure here, to test we export things right
-
post = '''
def process(filename):
src = \'\'\'
@@ -5499,6 +5496,11 @@ def process(filename):
self.do_run_from_file(src, output, post_build=post)
+ if self.emcc_args is not None and '-O2' in self.emcc_args:
+ print 'with closure'
+ self.emcc_args += ['--closure', '1']
+ self.do_run_from_file(src, output, post_build=post)
+
def test_pgo(self):
if Settings.ASM_JS: return self.skip('PGO does not work in asm mode')