LEFT | RIGHT |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding: utf-8 | 2 # coding: utf-8 |
3 | 3 |
4 # This Source Code is subject to the terms of the Mozilla Public License | 4 # This Source Code is subject to the terms of the Mozilla Public License |
5 # version 2.0 (the "License"). You can obtain a copy of the License at | 5 # version 2.0 (the "License"). You can obtain a copy of the License at |
6 # http://mozilla.org/MPL/2.0/. | 6 # http://mozilla.org/MPL/2.0/. |
7 | 7 |
8 import sys, os, subprocess, re, difflib, utils | 8 import sys, os, subprocess, re, difflib, utils |
9 | 9 |
10 def run_tests(): | 10 def run_tests(): |
(...skipping 17 matching lines...) Expand all Loading... |
28 if match and match.group(1).lower() == 'name': | 28 if match and match.group(1).lower() == 'name': |
29 name = match.group(2) | 29 name = match.group(2) |
30 elif match and match.group(1).lower() == 'arguments': | 30 elif match and match.group(1).lower() == 'arguments': |
31 arguments = match.group(2).split(' ') | 31 arguments = match.group(2).split(' ') |
32 handle.close() | 32 handle.close() |
33 | 33 |
34 if arguments == None: | 34 if arguments == None: |
35 continue | 35 continue |
36 | 36 |
37 command = [application, os.path.join(baseDir, 'jshydra.js'), file] + argumen
ts | 37 command = [application, os.path.join(baseDir, 'jshydra.js'), file] + argumen
ts |
38 out = subprocess.check_output(command, env=env).replace('\r', '') | 38 out = subprocess.check_output(command, stderr=subprocess.STDOUT, env=env).re
place('\r', '') |
39 expected = open(file + '.expected', 'r').read().replace('\r', '') | 39 expected = open(file + '.expected', 'r').read().replace('\r', '') |
40 if out == expected: | 40 if out == expected: |
41 print '%s passed' % name | 41 print '%s passed' % name |
42 else: | 42 else: |
43 print '%s failed! Log:' % name | 43 print '%s failed! Log:' % name |
44 for line in difflib.unified_diff(expected.split('\n'), out.split('\n'), fr
omfile=file + '.expected', tofile=file + '.output'): | 44 for line in difflib.unified_diff(expected.split('\n'), out.split('\n'), fr
omfile=file + '.expected', tofile=file + '.output'): |
45 print line | 45 print line |
46 print | 46 print |
47 | 47 |
48 if __name__ == '__main__': | 48 if __name__ == '__main__': |
49 run_tests() | 49 run_tests() |
LEFT | RIGHT |