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

Unified Diff: pkg/analyzer/test/src/task/strong/non_null_checker_test.dart

Issue 2205743002: Add non-null types list to StrongModeOptions (Closed) Base URL: https://github.com/dart-lang/sdk@master
Patch Set: Use annotation instead of prefix for 'failing test' Created 4 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
Index: pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart b/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
index 1b2a7a6de77f6e864c07d9e3ce6365c4a12c8290..1ba4aaf59baac9fe0ceecc7302677165f71d70ca 100644
--- a/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
@@ -42,4 +42,17 @@ main() {
}
''');
}
+
+ void test_nullableTypes() {
+ // By default x can be set to null.
+ addFile('''int x = null;''');
+ check();
+ }
+
+ @failingTest
+ void test_nonnullableTypes() {
+ // If `int`s are non-nullable, then this code should throw an error.
+ addFile('''int x = /*error:INVALID_ASSIGNMENT*/null;''');
+ check(nonnullableTypes: <String>['int']);
Jennifer Messerly 2016/08/02 16:18:51 to build on Brian's comment, consider qualifying i
Brian Wilkerson 2016/08/02 16:25:18 Unless this is intended to be a general purpose me
stanm 2016/08/02 16:56:05 I agree it's a bit of an overkill, but it actually
+ }
}

Powered by Google App Engine
This is Rietveld 408576698