[vala/wip/baedert/nullable: 23/25] tests: Add another nullability test



commit 658d389516dcd06b5d90dd03889b724aedef45bc
Author: Timm Bäder <mail baedert org>
Date:   Tue Nov 8 10:59:17 2016 +0100

    tests: Add another nullability test

 tests/Makefile.am                       |    3 ++-
 tests/nullability/null-assign-fail.test |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c1ef055..d309ad7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 0000000..74cfdc8
--- /dev/null
+++ b/tests/nullability/null-assign-fail.test
@@ -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;
+
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]