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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1020243004: Report separate UNUSED_CATCH_CLAUSE and UNUSED_CATCH_STACK hints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweak Created 5 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 | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 906bdd86dcdfd966142983b331b2407addf1974e..07776ff81ef684bd2a98f57d7dd9fb6786268c96 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -4155,11 +4155,38 @@ class B {}''');
Source source = addSource(r'''
main() {
try {
+ } on String catch (exception) {
+ }
+}''');
+ resolve(source);
+ assertErrors(source, [HintCode.UNUSED_CATCH_CLAUSE]);
+ verify([source]);
+ }
+
+ void test_unusedLocalVariable_inCatch_exception_hasStack() {
+ enableUnusedLocalVariable = true;
+ Source source = addSource(r'''
+main() {
+ try {
+ } catch (exception, stack) {
+ print(stack);
+ }
+}''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_unusedLocalVariable_inCatch_exception_noOnClause() {
+ enableUnusedLocalVariable = true;
+ Source source = addSource(r'''
+main() {
+ try {
} catch (exception) {
}
}''');
resolve(source);
- assertErrors(source);
+ assertNoErrors(source);
verify([source]);
}
@@ -4172,7 +4199,7 @@ main() {
}
}''');
resolve(source);
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ assertErrors(source, [HintCode.UNUSED_CATCH_STACK]);
verify([source]);
}
@@ -7621,7 +7648,9 @@ class ResolverTestCase extends EngineTestCase {
continue;
}
if (!enableUnusedLocalVariable &&
- errorCode == HintCode.UNUSED_LOCAL_VARIABLE) {
+ (errorCode == HintCode.UNUSED_CATCH_CLAUSE ||
+ errorCode == HintCode.UNUSED_CATCH_STACK ||
+ errorCode == HintCode.UNUSED_LOCAL_VARIABLE)) {
continue;
}
errorListener.onError(error);
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698