diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-26 17:41:32 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-26 17:41:32 -0500 |
commit | 893ff16260de2fd197de5a93cefa5614ba612a67 (patch) | |
tree | b22852526ac9f1a22bb644e392abaa0029be6e26 | |
parent | 6613b8135f7d4a214f79ee17982f214da47f2772 (diff) |
refactor js optimizer test
-rw-r--r-- | tests/runner.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/runner.py b/tests/runner.py index 74fb5057..108095bc 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -5312,11 +5312,12 @@ Options that are modified or new in %s include: self.assertIdentical(expected, output) def test_js_optimizer(self): - input = open(path_from_root('tools', 'test-js-optimizer.js')).read() - expected = open(path_from_root('tools', 'test-js-optimizer-output.js')).read() - output = Popen([NODE_JS, JS_OPTIMIZER, 'hoistMultiples', 'loopOptimizer', 'unGlobalize', 'removeAssignsToUndefined', 'simplifyExpressionsPre', 'simplifyExpressionsPost'], - stdin=PIPE, stdout=PIPE).communicate(input)[0] - self.assertIdentical(expected, output.replace('\n\n', '\n')) + for input, expected, passes in [ + (open(path_from_root('tools', 'test-js-optimizer.js')).read(), open(path_from_root('tools', 'test-js-optimizer-output.js')).read(), + ['hoistMultiples', 'loopOptimizer', 'unGlobalize', 'removeAssignsToUndefined', 'simplifyExpressionsPre', 'simplifyExpressionsPost']) + ]: + output = Popen([NODE_JS, JS_OPTIMIZER] + passes, stdin=PIPE, stdout=PIPE).communicate(input)[0] + self.assertIdentical(expected, output.replace('\n\n', '\n')) elif 'benchmark' in str(sys.argv): # Benchmarks. Run them with argument |benchmark|. To run a specific test, do |