[vala/wip/issue/327: 17/27] Added nullability tests



commit dbdc4fed80e3d0f6911563338cca2cf737cbf0f0
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 87b21b353..9109801fd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -938,6 +938,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 \
@@ -953,6 +954,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]