[vala/staging] tests: Add "member-access" tests to increase coverage



commit f11b86c0dffccd272677e8d61fdeb7a7f490c0d5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Nov 24 18:23:58 2019 +0100

    tests: Add "member-access" tests to increase coverage

 tests/Makefile.am                                        |  4 ++++
 tests/nullability/member-access-nullable-instance.test   | 10 ++++++++++
 tests/semantic/member-access-async-callback-invalid.test | 11 +++++++++++
 tests/semantic/member-access-capture-out.test            | 12 ++++++++++++
 tests/semantic/member-access-protected-invalid.test      | 10 ++++++++++
 5 files changed, 47 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bb873f603..a18e333c1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -750,6 +750,9 @@ TESTS = \
        semantic/localvariable-var-static-access-instance-property.test \
        semantic/localvariable-var-without-initializer.test \
        semantic/localvariable-void.test \
+       semantic/member-access-async-callback-invalid.test \
+       semantic/member-access-capture-out.test \
+       semantic/member-access-protected-invalid.test \
        semantic/method-abstract.test \
        semantic/method-abstract-body.test \
        semantic/method-async-ref-parameter.test \
@@ -834,6 +837,7 @@ TESTS = \
 NON_NULL_TESTS = \
        nullability/bug611223.vala \
        nullability/local-variable-invalid-convert.test \
+       nullability/member-access-nullable-instance.test \
        nullability/method-parameter-invalid-convert.test \
        nullability/method-return-invalid-convert.test \
        $(NULL)
diff --git a/tests/nullability/member-access-nullable-instance.test 
b/tests/nullability/member-access-nullable-instance.test
new file mode 100644
index 000000000..935b3fe80
--- /dev/null
+++ b/tests/nullability/member-access-nullable-instance.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+class Foo {
+       public int i;
+}
+
+void main () {
+       Foo? foo = new Foo ();
+       foo.i = 42;
+}
diff --git a/tests/semantic/member-access-async-callback-invalid.test 
b/tests/semantic/member-access-async-callback-invalid.test
new file mode 100644
index 000000000..0518fdf01
--- /dev/null
+++ b/tests/semantic/member-access-async-callback-invalid.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+async void bar () {
+}
+
+async void foo () {
+       bar.callback ();
+}
+
+void main () {
+}
diff --git a/tests/semantic/member-access-capture-out.test b/tests/semantic/member-access-capture-out.test
new file mode 100644
index 000000000..0fd2846e4
--- /dev/null
+++ b/tests/semantic/member-access-capture-out.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+delegate void FooFunc ();
+
+void foo (out string s) {
+       FooFunc f = () => {
+               s = "foo";
+       };
+}
+
+void main () {
+}
diff --git a/tests/semantic/member-access-protected-invalid.test 
b/tests/semantic/member-access-protected-invalid.test
new file mode 100644
index 000000000..b46bc1e2a
--- /dev/null
+++ b/tests/semantic/member-access-protected-invalid.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+class Foo {
+       protected int i;
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.i = 42;
+}


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