| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 executable, current_path, mode): | 99 executable, current_path, mode): |
| 100 pathname = join(self.root, filename + ".pyt") | 100 pathname = join(self.root, filename + ".pyt") |
| 101 source = open(pathname).read(); | 101 source = open(pathname).read(); |
| 102 def Test(name, source, expectation): | 102 def Test(name, source, expectation): |
| 103 throws = None | 103 throws = None |
| 104 if (expectation is not None): | 104 if (expectation is not None): |
| 105 throws = [expectation] | 105 throws = [expectation] |
| 106 test = PreparserTestCase(self.root, | 106 test = PreparserTestCase(self.root, |
| 107 current_path + [filename, name], | 107 current_path + [filename, name], |
| 108 executable, | 108 executable, |
| 109 mode, throws, self.context, source) | 109 mode, throws, self.context, |
| 110 source.replace("\n", " ")) |
| 110 result.append(test) | 111 result.append(test) |
| 111 def Template(name, source): | 112 def Template(name, source): |
| 112 def MkTest(replacement, expectation): | 113 def MkTest(replacement, expectation): |
| 113 testname = name | 114 testname = name |
| 114 testsource = source | 115 testsource = source |
| 115 for key in replacement.keys(): | 116 for key in replacement.keys(): |
| 116 testname = testname.replace("$"+key, replacement[key]); | 117 testname = testname.replace("$"+key, replacement[key]); |
| 117 testsource = testsource.replace("$"+key, replacement[key]); | 118 testsource = testsource.replace("$"+key, replacement[key]); |
| 118 Test(testname, testsource, expectation) | 119 Test(testname, testsource, expectation) |
| 119 return MkTest | 120 return MkTest |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 status_file = join(self.root, 'preparser.status') | 152 status_file = join(self.root, 'preparser.status') |
| 152 if exists(status_file): | 153 if exists(status_file): |
| 153 test.ReadConfigurationInto(status_file, sections, defs) | 154 test.ReadConfigurationInto(status_file, sections, defs) |
| 154 | 155 |
| 155 def VariantFlags(self): | 156 def VariantFlags(self): |
| 156 return [[]]; | 157 return [[]]; |
| 157 | 158 |
| 158 | 159 |
| 159 def GetConfiguration(context, root): | 160 def GetConfiguration(context, root): |
| 160 return PreparserTestConfiguration(context, root) | 161 return PreparserTestConfiguration(context, root) |
| OLD | NEW |