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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 var isNegative = info.hasCompileError; | 620 var isNegative = info.hasCompileError; |
621 if (info.hasRuntimeError && hasRuntime) { | 621 if (info.hasRuntimeError && hasRuntime) { |
622 isNegative = true; | 622 isNegative = true; |
623 } | 623 } |
624 | 624 |
625 // Look up expectations in status files using a test name generated | 625 // Look up expectations in status files using a test name generated |
626 // from the test file's path. | 626 // from the test file's path. |
627 String testName; | 627 String testName; |
628 | 628 |
629 if (optionsFromFile['isMultitest']) { | 629 if (optionsFromFile['isMultitest']) { |
630 // Multitests do not run on browsers. | |
631 if (TestUtils.isBrowserRuntime(configuration['runtime'])) return; | |
632 // Multitests are in [build directory]/generated_tests/... . | 630 // Multitests are in [build directory]/generated_tests/... . |
633 // The test name will be '[test filename (no extension)]/[multitest key]. | 631 // The test name will be '[test filename (no extension)]/[multitest key]. |
634 String name = filePath.filenameWithoutExtension; | 632 String name = filePath.filenameWithoutExtension; |
635 int middle = name.lastIndexOf('_'); | 633 int middle = name.lastIndexOf('_'); |
636 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; | 634 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; |
637 } else { | 635 } else { |
638 // The test name is the relative path from the test suite directory to | 636 // The test name is the relative path from the test suite directory to |
639 // the test, with the .dart extension removed. | 637 // the test, with the .dart extension removed. |
640 Expect.isTrue(filePath.toNativePath().startsWith( | 638 Expect.isTrue(filePath.toNativePath().startsWith( |
641 suiteDir.toNativePath())); | 639 suiteDir.toNativePath())); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1303 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); | 1301 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); |
1304 RegExp staticCleanRegExp = new RegExp(r"// @static-clean"); | 1302 RegExp staticCleanRegExp = new RegExp(r"// @static-clean"); |
1305 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); | 1303 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); |
1306 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1304 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); |
1307 // TODO(gram) Clean these up once the old directives are not supported. | 1305 // TODO(gram) Clean these up once the old directives are not supported. |
1308 RegExp domImportRegExp = | 1306 RegExp domImportRegExp = |
1309 new RegExp(r"^[#]?import.*dart:html", multiLine: true); | 1307 new RegExp(r"^[#]?import.*dart:html", multiLine: true); |
1310 RegExp libraryDefinitionRegExp = | 1308 RegExp libraryDefinitionRegExp = |
1311 new RegExp(r"^[#]?library[\( ]", multiLine: true); | 1309 new RegExp(r"^[#]?library[\( ]", multiLine: true); |
1312 RegExp sourceOrImportRegExp = | 1310 RegExp sourceOrImportRegExp = |
1313 new RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true); | 1311 new RegExp("^(#?source|#?import|part)[ \t]+[\('\"]", multiLine: true); |
kustermann
2013/01/16 17:54:55
This was broken before. After correcting this we'l
ahe
2013/01/16 17:57:25
We should reword the warning to inform the user th
| |
1314 | 1312 |
1315 var bytes = new File.fromPath(filePath).readAsBytesSync(); | 1313 var bytes = new File.fromPath(filePath).readAsBytesSync(); |
1316 String contents = decodeUtf8(bytes); | 1314 String contents = decodeUtf8(bytes); |
1317 bytes = null; | 1315 bytes = null; |
1318 | 1316 |
1319 // Find the options in the file. | 1317 // Find the options in the file. |
1320 List<List> result = new List<List>(); | 1318 List<List> result = new List<List>(); |
1321 List<String> dartOptions; | 1319 List<String> dartOptions; |
1322 String packageRoot; | 1320 String packageRoot; |
1323 bool hasCompileError = contents.contains("@compile-error"); | 1321 bool hasCompileError = contents.contains("@compile-error"); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1833 * $pass tests are expected to pass | 1831 * $pass tests are expected to pass |
1834 * $failOk tests are expected to fail that we won't fix | 1832 * $failOk tests are expected to fail that we won't fix |
1835 * $fail tests are expected to fail that we should fix | 1833 * $fail tests are expected to fail that we should fix |
1836 * $crash tests are expected to crash that we should fix | 1834 * $crash tests are expected to crash that we should fix |
1837 * $timeout tests are allowed to timeout | 1835 * $timeout tests are allowed to timeout |
1838 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1836 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
1839 """; | 1837 """; |
1840 print(report); | 1838 print(report); |
1841 } | 1839 } |
1842 } | 1840 } |
OLD | NEW |