[vala/wip/issue/327: 38/43] Added nullability tests



commit b51efba279887bf901b8cff0504f9339d3f6ad88
Author: Nick Schrader <nick schrader mailbox org>
Date:   Fri Apr 3 18:06:58 2020 -0300

    Added nullability tests

 tests/Makefile.am                    |  2 ++
 tests/nullability/with-non-null.test | 12 ++++++++++++
 tests/semantic/with-null.vala        | 12 ++++++++++++
 3 files changed, 26 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 709eb05fc..555694059 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -927,6 +927,7 @@ TESTS = \
        semantic/with-namespace.test \
        semantic/with-no-such-member.test \
        semantic/with-no-such-with-member.test \
+       semantic/with-null.vala \
        semantic/with-string.vala \
        semantic/with-value.vala \
        semantic/yield-call-requires-async-context.test \
@@ -942,6 +943,7 @@ NON_NULL_TESTS = \
        nullability/member-access-nullable-instance.test \
        nullability/method-parameter-invalid-convert.test \
        nullability/method-return-invalid-convert.test \
+       nullability/with-non-null.test \
        $(NULL)
 
 LINUX_TESTS = \
diff --git a/tests/nullability/with-non-null.test b/tests/nullability/with-non-null.test
new file mode 100644
index 000000000..1d0b16f38
--- /dev/null
+++ b/tests/nullability/with-non-null.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo {
+    public int i;
+}
+
+void main() {
+    Foo? f = new Foo();
+    with (f) {
+        i = 7;
+    }
+}
diff --git a/tests/semantic/with-null.vala b/tests/semantic/with-null.vala
new file mode 100644
index 000000000..602ac5cef
--- /dev/null
+++ b/tests/semantic/with-null.vala
@@ -0,0 +1,12 @@
+class Foo {
+    public int i;
+}
+
+void main() {
+    Foo? f = null;
+    Process.exit(0);
+
+    with (f) {
+        i = 7;
+    }
+}


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