Chromium Code Reviews| 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. |
|
Emily Fortuna
2017/03/21 00:49:06
Are you going to have a followup CL where you remo
|
| +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) |