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

Unified Diff: test/rule_test.dart

Issue 1415183009: Adds check for `AsExpression`s (Fix #145). (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: reorg Created 5 years, 1 month 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 | « lib/src/rules/avoid_as.dart ('k') | test/rules/avoid_as.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/rule_test.dart
diff --git a/test/rule_test.dart b/test/rule_test.dart
index 9d8a4d4da5510535abbda0868084ab5acb266172..de2a58c726fa872b605e0c0de29547158212f9bc 100644
--- a/test/rule_test.dart
+++ b/test/rule_test.dart
@@ -341,6 +341,10 @@ testEach(Iterable<String> values, dynamic f(String s), Matcher m) {
testRule(String ruleName, File file, {bool debug: false}) {
test('$ruleName', () {
+ if (!file.existsSync()) {
+ throw new Exception('No rule found defined at: ${file.path}');
+ }
+
var expected = <AnnotationMatcher>[];
int lineNumber = 1;
@@ -353,8 +357,13 @@ testRule(String ruleName, File file, {bool debug: false}) {
++lineNumber;
}
- LinterOptions options = new LinterOptions(
- [ruleRegistry[ruleName]].where((rule) => rule != null))
+ LintRule rule = ruleRegistry[ruleName];
+ if (rule == null) {
+ print('WARNING: Test skipped -- rule `$ruleName` is not registered.');
+ return;
+ }
+
+ LinterOptions options = new LinterOptions([rule])
..useMockSdk = true
..packageRootPath = '.';
« no previous file with comments | « lib/src/rules/avoid_as.dart ('k') | test/rules/avoid_as.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698