]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add another nullability test
authorTimm Bäder <mail@baedert.org>
Tue, 8 Nov 2016 09:59:17 +0000 (10:59 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 8 Nov 2016 09:59:17 +0000 (10:59 +0100)
tests/Makefile.am
tests/nullability/null-assign-fail.test [new file with mode: 0644]

index c1ef055e684eea0810f81739200cad4d1aefb458..d309ad70b6d5a41cee4eb74a06d2aa9b379dd373 100644 (file)
@@ -239,7 +239,8 @@ TESTS = \
        nullability/assignment-to-non-nullable-ok.vala \
        nullability/assignment-to-non-nullable-fail.test \
        nullability/coalesce-operator.vala \
-       nullability/non-null-assign.vala
+       nullability/non-null-assign.vala \
+       nullability/null-assign-fail.test \
        $(NULL)
 
 check-TESTS: $(TESTS)
diff --git a/tests/nullability/null-assign-fail.test b/tests/nullability/null-assign-fail.test
new file mode 100644 (file)
index 0000000..74cfdc8
--- /dev/null
@@ -0,0 +1,14 @@
+Invalid Code
+
+void main () {
+  string f = "guaranteed not null";
+
+  // OK
+  int k = f.length;
+
+  f = null;
+
+  // Not OK
+  k = f.length;
+
+}