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 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 var isolateStubs = isolateMatch != null ? isolateMatch[1] : ''; | 1565 var isolateStubs = isolateMatch != null ? isolateMatch[1] : ''; |
1566 var containsDomImport = domImportRegExp.hasMatch(contents); | 1566 var containsDomImport = domImportRegExp.hasMatch(contents); |
1567 | 1567 |
1568 var subtestNames = <String>[]; | 1568 var subtestNames = <String>[]; |
1569 var matchesIter = multiHtmlTestGroupRegExp.allMatches(contents).iterator; | 1569 var matchesIter = multiHtmlTestGroupRegExp.allMatches(contents).iterator; |
1570 while (matchesIter.moveNext() && isMultiHtmlTest) { | 1570 while (matchesIter.moveNext() && isMultiHtmlTest) { |
1571 var fullMatch = matchesIter.current.group(0); | 1571 var fullMatch = matchesIter.current.group(0); |
1572 subtestNames.add(fullMatch.substring(fullMatch.indexOf("'") + 1)); | 1572 subtestNames.add(fullMatch.substring(fullMatch.indexOf("'") + 1)); |
1573 } | 1573 } |
1574 | 1574 |
1575 // TODO(rnystrom): During the migration of the existing tests to Dart 2.0, | |
1576 // we have a number of tests that used to both generate static type warnings | |
1577 // and also validate some runtime behavior in an implementation that | |
1578 // ignores those warnings. Those warnings are now errors. The test code | |
1579 // validates the runtime behavior can and should be removed, but the code | |
1580 // that causes the static warning should still be preserved since that is | |
1581 // part of our coverage of the static type system. | |
1582 // | |
1583 // The test needs to indicate that it should have a static error. We could | |
1584 // put that in the status file, but that makes it confusing because it | |
1585 // would look like implementations that *don't* report the error are more | |
1586 // correct. Eventually, we want to have a notation similar to what front_end | |
1587 // is using for the inference tests where we can put a comment inside the | |
1588 // test that says "This specific static error should be reported right by | |
1589 // this token." | |
1590 // | |
1591 // That system isn't in place yet, so we do a crude approximation here in | |
1592 // test.dart. If a test contains `/*@compile-error=`, which matches the | |
1593 // beginning of the tag syntax that front_end uses, then we assume that | |
1594 // this test must have a static error somewhere in it. | |
1595 // | |
1596 // Redo this code once we have a more precise test framework for detecting | |
1597 // and locating these errors. | |
1598 var hasCompileError = contents.contains("/*@compile-error="); | |
1599 | |
1600 return { | 1575 return { |
1601 "vmOptions": result, | 1576 "vmOptions": result, |
1602 "sharedOptions": sharedOptions ?? [], | 1577 "sharedOptions": sharedOptions ?? [], |
1603 "dartOptions": dartOptions, | 1578 "dartOptions": dartOptions, |
1604 "packageRoot": packageRoot, | 1579 "packageRoot": packageRoot, |
1605 "packages": packages, | 1580 "packages": packages, |
1606 "hasCompileError": hasCompileError, | 1581 "hasCompileError": false, |
1607 "hasRuntimeError": false, | 1582 "hasRuntimeError": false, |
1608 "hasStaticWarning": false, | 1583 "hasStaticWarning": false, |
1609 "otherScripts": otherScripts, | 1584 "otherScripts": otherScripts, |
1610 "otherResources": otherResources, | 1585 "otherResources": otherResources, |
1611 "isMultitest": isMultitest, | 1586 "isMultitest": isMultitest, |
1612 "isMultiHtmlTest": isMultiHtmlTest, | 1587 "isMultiHtmlTest": isMultiHtmlTest, |
1613 "subtestNames": subtestNames, | 1588 "subtestNames": subtestNames, |
1614 "isolateStubs": isolateStubs, | 1589 "isolateStubs": isolateStubs, |
1615 "containsDomImport": containsDomImport | 1590 "containsDomImport": containsDomImport |
1616 }; | 1591 }; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 | 1765 |
1791 bool isTestFile(String filename) { | 1766 bool isTestFile(String filename) { |
1792 // NOTE: We exclude tests and patch files for now. | 1767 // NOTE: We exclude tests and patch files for now. |
1793 return filename.endsWith(".dart") && | 1768 return filename.endsWith(".dart") && |
1794 !filename.endsWith("_test.dart") && | 1769 !filename.endsWith("_test.dart") && |
1795 !filename.contains("_internal/js_runtime/lib"); | 1770 !filename.contains("_internal/js_runtime/lib"); |
1796 } | 1771 } |
1797 | 1772 |
1798 bool get listRecursively => true; | 1773 bool get listRecursively => true; |
1799 } | 1774 } |
OLD | NEW |