| OLD | NEW |
| 1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2011 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 expects = [] | 56 expects = [] |
| 57 if (rule_match.group(2)): | 57 if (rule_match.group(2)): |
| 58 expects += [rule_match.group(2)] | 58 expects += [rule_match.group(2)] |
| 59 if (rule_match.group(3)): | 59 if (rule_match.group(3)): |
| 60 expects += [rule_match.group(3), rule_match.group(4)] | 60 expects += [rule_match.group(3), rule_match.group(4)] |
| 61 expectations_map[rule_match.group(1)] = " ".join(expects) | 61 expectations_map[rule_match.group(1)] = " ".join(expects) |
| 62 return expectations_map | 62 return expectations_map |
| 63 | 63 |
| 64 def _ParsePythonTestTemplates(self, result, filename): | 64 def _ParsePythonTestTemplates(self, result, filename): |
| 65 pathname = os.path.join(self.root, filename + ".pyt") | 65 pathname = os.path.join(self.root, filename + ".pyt") |
| 66 def Test(name, source, expectation): | 66 def Test(name, source, expectation, extra_flags=[]): |
| 67 source = source.replace("\n", " ") | 67 source = source.replace("\n", " ") |
| 68 testname = os.path.join(filename, name) | 68 testname = os.path.join(filename, name) |
| 69 flags = ["-e", source] | 69 flags = ["-e", source] |
| 70 if expectation: | 70 if expectation: |
| 71 flags += ["--throws"] | 71 flags += ["--throws"] |
| 72 flags += extra_flags |
| 72 test = testcase.TestCase(self, testname, flags=flags) | 73 test = testcase.TestCase(self, testname, flags=flags) |
| 73 result.append(test) | 74 result.append(test) |
| 74 def Template(name, source): | 75 def Template(name, source): |
| 75 def MkTest(replacement, expectation): | 76 def MkTest(replacement, expectation): |
| 76 testname = name | 77 testname = name |
| 77 testsource = source | 78 testsource = source |
| 78 for key in replacement.keys(): | 79 for key in replacement.keys(): |
| 79 testname = testname.replace("$" + key, replacement[key]); | 80 testname = testname.replace("$" + key, replacement[key]); |
| 80 testsource = testsource.replace("$" + key, replacement[key]); | 81 testsource = testsource.replace("$" + key, replacement[key]); |
| 81 Test(testname, testsource, expectation) | 82 Test(testname, testsource, expectation) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return testcase.flags[1] | 125 return testcase.flags[1] |
| 125 with open(testcase.flags[0]) as f: | 126 with open(testcase.flags[0]) as f: |
| 126 return f.read() | 127 return f.read() |
| 127 | 128 |
| 128 def VariantFlags(self, testcase, default_flags): | 129 def VariantFlags(self, testcase, default_flags): |
| 129 return [[]]; | 130 return [[]]; |
| 130 | 131 |
| 131 | 132 |
| 132 def GetSuite(name, root): | 133 def GetSuite(name, root): |
| 133 return PreparserTestSuite(name, root) | 134 return PreparserTestSuite(name, root) |
| OLD | NEW |