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

Unified Diff: tools/migration/lib/src/validate.dart

Issue 2991803003: Report more heuristics for tests that require manual work. (Closed)
Patch Set: Tweaks. Created 3 years, 5 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 | « tools/migration/lib/src/log.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/migration/lib/src/validate.dart
diff --git a/tools/migration/lib/src/validate.dart b/tools/migration/lib/src/validate.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5dbbeaaabd9188537d0d0a2441f0ca7297c73efe
--- /dev/null
+++ b/tools/migration/lib/src/validate.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'log.dart';
+
+final _unittestPattern = "package:unittest";
+final _checkedPattern = new RegExp(r"\bchecked\b");
+final _abstractErrorPattern =
+ new RegExp(r"\bAbstractClassInstantiationError\b");
+final _typeErrorPattern = new RegExp(r"\bTypeError\b");
+
+void validateFile(String path, String source, [List<String> todos]) {
+ check(Pattern pattern, String noteMessage, String todo) {
+ if (!source.contains(pattern)) return;
+ note("${bold(path)} $noteMessage.");
+ if (todos != null) todos.add(todo);
+ }
+
+ check(_unittestPattern, "uses the unittest package", "Migrate off unittest.");
+ check(_checkedPattern, 'mentions "checked"',
+ 'Fix code that mentions "checked" mode.');
+ check(_abstractErrorPattern, 'mentions "AbstractClassInstantiationError"',
+ "Remove code that checks for AbstractClassInstantiationError.");
+ check(_typeErrorPattern, 'mentions "TypeError"',
+ "Ensure code that checks for a TypeError uses 2.0 semantics.");
+}
« no previous file with comments | « tools/migration/lib/src/log.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698