Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Unified Diff: pkg/dev_compiler/test/multitest.dart

Issue 2765893003: Fix warnings_checker.dart handling of multitests (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/testing/lib/src/multitest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/test/multitest.dart
diff --git a/pkg/dev_compiler/test/multitest.dart b/pkg/dev_compiler/test/multitest.dart
index 6d9acd7e0338f9e2bcd2037fe81e1ca7f68d6fdb..7451bfb05c4481e3271e1d6fb0659e22816f8966 100644
--- a/pkg/dev_compiler/test/multitest.dart
+++ b/pkg/dev_compiler/test/multitest.dart
@@ -15,8 +15,11 @@ final validMultitestOutcomes = new Set<String>.from([
'checked mode compile-time error'
]);
-// Require at least one non-space character before '///'
-final _multiTestRegExp = new RegExp(r"\S */// \w+:(.*)");
+// Require at least one non-space character before '//#'
+// Handle both //# and the legacy /// multitest regexp patterns.
+final _multiTestRegExp = new RegExp(r"\S *//[#/] \w+:(.*)");
+
+final _multiTestRegExpSeperator = new RegExp(r"//[#/]");
bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
@@ -37,10 +40,10 @@ bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
//
// For example: file I_am_a_multitest.dart
// aaa
-// bbb /// 02: runtime error
-// ccc /// 02: continued
-// ddd /// 07: static type warning
-// eee /// 10: ok
+// bbb //# 02: runtime error
+// ccc //# 02: continued
+// ddd //# 07: static type warning
+// eee //# 10: ok
// fff
//
// should create four tests:
@@ -50,24 +53,24 @@ bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
//
// I_am_a_multitest_02.dart
// aaa
-// bbb /// 02: runtime error
-// ccc /// 02: continued
+// bbb //# 02: runtime error
+// ccc //# 02: continued
// fff
//
// I_am_a_multitest_07.dart
// aaa
-// ddd /// 07: static type warning
+// ddd //# 07: static type warning
// fff
//
// and I_am_a_multitest_10.dart
// aaa
-// eee /// 10: ok
+// eee //# 10: ok
// fff
//
// Note that it is possible to indicate more than one acceptable outcome
// in the case of dynamic and static type warnings
// aaa
-// ddd /// 07: static type warning, dynamic type error
+// ddd //# 07: static type warning, dynamic type error
// fff
void extractTestsFromMultitest(String filePath, String contents,
@@ -142,7 +145,7 @@ void extractTestsFromMultitest(String filePath, String contents,
}
}
-// Represents a mutlitest annotation in the special /// comment.
+// Represents a mutlitest annotation in the special //# comment.
class _Annotation {
String key;
String rest;
@@ -151,11 +154,11 @@ class _Annotation {
factory _Annotation.from(String line) {
// Do an early return with "null" if this is not a valid multitest
// annotation.
- if (!line.contains('///')) {
+ if (!line.contains(_multiTestRegExpSeperator)) {
return null;
}
var parts = line
- .split('///')[1]
+ .split(_multiTestRegExpSeperator)[1]
.split(':')
.map((s) => s.trim())
.where((s) => s.length > 0)
« no previous file with comments | « no previous file | pkg/testing/lib/src/multitest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698