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

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

Issue 1644683002: A missing enum case in a switch is a warning, not a compile-time error. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/test/generated/compile_time_error_code_test.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/static_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index eb6aa8bbd76b4c0c614b81ffc36050f4dcc7ce11..02c44b83acb0eecabfa9906b4e9d439532663205 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -3616,4 +3616,22 @@ class S {
computeLibrarySourceErrors(source);
assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
}
+
+ void test_missingEnumConstantInSwitch() {
+ Source source = addSource(r'''
+enum E { ONE, TWO, THREE, FOUR }
+bool odd(E e) {
+ switch (e) {
+ case E.ONE:
+ case E.THREE: return true;
+ }
+ return false;
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [
+ StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
+ StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH
+ ]);
+ verify([source]);
+ }
}
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698