[vala/wip/issue/327: 17/27] Added nullability tests
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/327: 17/27] Added nullability tests
- Date: Mon, 27 Apr 2020 12:15:27 +0000 (UTC)
commit 5e1752e349c2e04f4d71364493146510c9f09e26
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 717bd922b..75276e894 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -939,6 +939,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 \
@@ -954,6 +955,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]