| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 * snapshot to the expectation file. When tests fail, 'test.dart' saves the | 1173 * snapshot to the expectation file. When tests fail, 'test.dart' saves the |
| 1174 * new snapshot into a file so it can be visualized or copied over. | 1174 * new snapshot into a file so it can be visualized or copied over. |
| 1175 * Expectations can be recorded for the first time by creating an empty file | 1175 * Expectations can be recorded for the first time by creating an empty file |
| 1176 * with the right name (touch test_name_test.png), running the test, and | 1176 * with the right name (touch test_name_test.png), running the test, and |
| 1177 * executing the copy command printed by the test script. | 1177 * executing the copy command printed by the test script. |
| 1178 * | 1178 * |
| 1179 * This method is static as the map is cached and shared amongst | 1179 * This method is static as the map is cached and shared amongst |
| 1180 * configurations, so it may not use [configuration]. | 1180 * configurations, so it may not use [configuration]. |
| 1181 */ | 1181 */ |
| 1182 static Map readOptionsFromFile(Path filePath) { | 1182 static Map readOptionsFromFile(Path filePath) { |
| 1183 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); | 1183 RegExp testOptionsRegExp = const RegExp(r"// VMOptions=(.*)"); |
| 1184 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); | 1184 RegExp dartOptionsRegExp = const RegExp(r"// DartOptions=(.*)"); |
| 1185 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); | 1185 RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)"); |
| 1186 RegExp multiTestRegExp = new RegExp(r"/// [0-9][0-9]:(.*)"); | 1186 RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)"); |
| 1187 RegExp multiHtmlTestRegExp = | 1187 RegExp multiHtmlTestRegExp = |
| 1188 new RegExp(r"useHtmlIndividualConfiguration()"); | 1188 const RegExp(r"useHtmlIndividualConfiguration()"); |
| 1189 RegExp staticTypeRegExp = | 1189 RegExp staticTypeRegExp = |
| 1190 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning"); | 1190 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning"); |
| 1191 RegExp compileTimeRegExp = | 1191 RegExp compileTimeRegExp = |
| 1192 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); | 1192 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); |
| 1193 RegExp staticCleanRegExp = new RegExp(r"// @static-clean"); | 1193 RegExp staticCleanRegExp = const RegExp(r"// @static-clean"); |
| 1194 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); | 1194 RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true); |
| 1195 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1195 RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)"); |
| 1196 // TODO(gram) Clean these up once the old directives are not supported. | 1196 // TODO(gram) Clean these up once the old directives are not supported. |
| 1197 RegExp domImportRegExp = | 1197 RegExp domImportRegExp = |
| 1198 new RegExp(r"^[#]?import.*dart:html", multiLine: true); | 1198 const RegExp(r"^[#]?import.*dart:html", multiLine: true); |
| 1199 RegExp libraryDefinitionRegExp = | 1199 RegExp libraryDefinitionRegExp = |
| 1200 new RegExp(r"^[#]?library[\( ]", multiLine: true); | 1200 const RegExp(r"^[#]?library[\( ]", multiLine: true); |
| 1201 RegExp sourceOrImportRegExp = | 1201 RegExp sourceOrImportRegExp = |
| 1202 new RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true); | 1202 const RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true); |
| 1203 | 1203 |
| 1204 // Read the entire file into a byte buffer and transform it to a | 1204 // Read the entire file into a byte buffer and transform it to a |
| 1205 // String. This will treat the file as ascii but the only parts | 1205 // String. This will treat the file as ascii but the only parts |
| 1206 // we are interested in will be ascii in any case. | 1206 // we are interested in will be ascii in any case. |
| 1207 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); | 1207 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); |
| 1208 List chars = new List(file.lengthSync()); | 1208 List chars = new List(file.lengthSync()); |
| 1209 var offset = 0; | 1209 var offset = 0; |
| 1210 while (offset != chars.length) { | 1210 while (offset != chars.length) { |
| 1211 offset += file.readListSync(chars, offset, chars.length - offset); | 1211 offset += file.readListSync(chars, offset, chars.length - offset); |
| 1212 } | 1212 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 * $pass tests are expected to pass | 1631 * $pass tests are expected to pass |
| 1632 * $failOk tests are expected to fail that we won't fix | 1632 * $failOk tests are expected to fail that we won't fix |
| 1633 * $fail tests are expected to fail that we should fix | 1633 * $fail tests are expected to fail that we should fix |
| 1634 * $crash tests are expected to crash that we should fix | 1634 * $crash tests are expected to crash that we should fix |
| 1635 * $timeout tests are allowed to timeout | 1635 * $timeout tests are allowed to timeout |
| 1636 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1636 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1637 """; | 1637 """; |
| 1638 print(report); | 1638 print(report); |
| 1639 } | 1639 } |
| 1640 } | 1640 } |
| OLD | NEW |