diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-08-07 21:35:17 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-08-07 21:35:17 -0700 |
commit | 7172aacb563367fae198c25743827ef1195083aa (patch) | |
tree | 6681cb0ce8a247e79f7f5fbe4c2b252f3248187a /tests/runner.py | |
parent | 19d18fbffd8f79bbe7cece5806903b2a6c1561e9 (diff) |
filesystem workaround for closure compiler, +closure compiler test
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index abbedd70..ebebfc16 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -3343,6 +3343,28 @@ Child2:9 ### Tests for tools + def test_closure_compiler(self): + src = ''' + #include<stdio.h> + int main() { + printf("*closured*\\n"); + return 0; + } + ''' + + def add_cc(filename): + Popen(['java', '-jar', CLOSURE_COMPILER, + '--compilation_level', 'ADVANCED_OPTIMIZATIONS', + '--formatting', 'PRETTY_PRINT', + '--variable_map_output_file', filename + '.vars', + '--js', filename, '--js_output_file', filename + '.cc.js'], stdout=PIPE, stderr=STDOUT).communicate() + assert not re.search('function \w\(', open(filename, 'r').read()) # closure generates this kind of stuff - functions with single letters. Normal doesn't. + src = open(filename + '.cc.js', 'r').read() + assert re.search('function \w\(', src) # see before + assert 'function _main()' not in src # closure should have wiped it out + open(filename, 'w').write(src) + self.do_test(src, '*closured*', post_build=add_cc) + def test_safe_heap(self): global SAFE_HEAP, SAFE_HEAP_LINES |