[vala/wip/issue/327: 31/41] Added nullability tests
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/327: 31/41] Added nullability tests
- Date: Sun, 10 May 2020 16:40:11 +0000 (UTC)
commit 003e1543443a039a2862b12c7e085ae2fac16f4d
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 8f5fcfb07..c6ecd5c17 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -946,6 +946,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 \
@@ -961,6 +962,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]