| 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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 * of what is rendered in the page at that moment. This snapshot is | 943 * of what is rendered in the page at that moment. This snapshot is |
| 944 * represented either in text form, if the expectation ends in .txt, or as | 944 * represented either in text form, if the expectation ends in .txt, or as |
| 945 * an image, if the expectation ends in .png. 'test.dart' will compare the | 945 * an image, if the expectation ends in .png. 'test.dart' will compare the |
| 946 * snapshot to the expectation file. When tests fail, 'test.dart' saves the | 946 * snapshot to the expectation file. When tests fail, 'test.dart' saves the |
| 947 * new snapshot into a file so it can be visualized or copied over. | 947 * new snapshot into a file so it can be visualized or copied over. |
| 948 * Expectations can be recorded for the first time by creating an empty file | 948 * Expectations can be recorded for the first time by creating an empty file |
| 949 * with the right name (touch test_name_test.png), running the test, and | 949 * with the right name (touch test_name_test.png), running the test, and |
| 950 * executing the copy command printed by the test script. | 950 * executing the copy command printed by the test script. |
| 951 */ | 951 */ |
| 952 Map readOptionsFromFile(Path filePath) { | 952 Map readOptionsFromFile(Path filePath) { |
| 953 RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)"); | 953 RegExp testOptionsRegExp = const RegExp(r"// VMOptions=(.*)"); |
| 954 RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)"); | 954 RegExp dartOptionsRegExp = const RegExp(r"// DartOptions=(.*)"); |
| 955 RegExp otherScriptsRegExp = const RegExp(@"// OtherScripts=(.*)"); | 955 RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)"); |
| 956 RegExp multiTestRegExp = const RegExp(@"/// [0-9][0-9]:(.*)"); | 956 RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)"); |
| 957 RegExp staticTypeRegExp = | 957 RegExp staticTypeRegExp = |
| 958 const RegExp(@"/// ([0-9][0-9]:){0,1}\s*static type warning"); | 958 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning"); |
| 959 RegExp compileTimeRegExp = | 959 RegExp compileTimeRegExp = |
| 960 const RegExp(@"/// ([0-9][0-9]:){0,1}\s*compile-time error"); | 960 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); |
| 961 RegExp staticCleanRegExp = const RegExp(@"// @static-clean"); | 961 RegExp staticCleanRegExp = const RegExp(r"// @static-clean"); |
| 962 RegExp leadingHashRegExp = const RegExp(@"^#", multiLine: true); | 962 RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true); |
| 963 RegExp isolateStubsRegExp = const RegExp(@"// IsolateStubs=(.*)"); | 963 RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)"); |
| 964 RegExp domImportRegExp = | 964 RegExp domImportRegExp = |
| 965 const RegExp(@"^#import.*(dart:(dom|html)|html\.dart).*\)", | 965 const RegExp(r"^#import.*(dart:(dom|html)|html\.dart).*\)", |
| 966 multiLine: true); | 966 multiLine: true); |
| 967 RegExp libraryDefinitionRegExp = | 967 RegExp libraryDefinitionRegExp = |
| 968 const RegExp(@"^#library\(", multiLine: true); | 968 const RegExp(r"^#library\(", multiLine: true); |
| 969 RegExp sourceOrImportRegExp = | 969 RegExp sourceOrImportRegExp = |
| 970 const RegExp(@"^#(source|import|resource)\(", multiLine: true); | 970 const RegExp(r"^#(source|import|resource)\(", multiLine: true); |
| 971 RegExp extraCommandRegExp = | 971 RegExp extraCommandRegExp = |
| 972 const RegExp(@"// ExtraCommand=(.*)", multiLine: true); | 972 const RegExp(r"// ExtraCommand=(.*)", multiLine: true); |
| 973 RegExp extraArgsRegExp = | 973 RegExp extraArgsRegExp = |
| 974 const RegExp(@"// ExtraCommandArgs=(.*)", multiLine: true); | 974 const RegExp(r"// ExtraCommandArgs=(.*)", multiLine: true); |
| 975 | |
| 976 // Read the entire file into a byte buffer and transform it to a | 975 // Read the entire file into a byte buffer and transform it to a |
| 977 // String. This will treat the file as ascii but the only parts | 976 // String. This will treat the file as ascii but the only parts |
| 978 // we are interested in will be ascii in any case. | 977 // we are interested in will be ascii in any case. |
| 979 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); | 978 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); |
| 980 List chars = new List(file.lengthSync()); | 979 List chars = new List(file.lengthSync()); |
| 981 var offset = 0; | 980 var offset = 0; |
| 982 while (offset != chars.length) { | 981 while (offset != chars.length) { |
| 983 offset += file.readListSync(chars, offset, chars.length - offset); | 982 offset += file.readListSync(chars, offset, chars.length - offset); |
| 984 } | 983 } |
| 985 file.closeSync(); | 984 file.closeSync(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 * $noCrash tests are expected to be flaky but not crash | 1460 * $noCrash tests are expected to be flaky but not crash |
| 1462 * $pass tests are expected to pass | 1461 * $pass tests are expected to pass |
| 1463 * $failOk tests are expected to fail that we won't fix | 1462 * $failOk tests are expected to fail that we won't fix |
| 1464 * $fail tests are expected to fail that we should fix | 1463 * $fail tests are expected to fail that we should fix |
| 1465 * $crash tests are expected to crash that we should fix | 1464 * $crash tests are expected to crash that we should fix |
| 1466 * $timeout tests are allowed to timeout | 1465 * $timeout tests are allowed to timeout |
| 1467 """; | 1466 """; |
| 1468 print(report); | 1467 print(report); |
| 1469 } | 1468 } |
| 1470 } | 1469 } |
| OLD | NEW |