[vala/0.54] tests: Add more invalid "member access" tests to increase coverage



commit 57d1520651ec5d60c9ea725d291b32cc8b5825eb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Oct 18 12:23:21 2021 +0200

    tests: Add more invalid "member access" tests to increase coverage

 tests/Makefile.am                              |  3 +++
 tests/delegates/lambda-outer-constant.test     | 11 +++++++++++
 tests/semantic/member-access-not-found.test    |  9 +++++++++
 tests/semantic/member-access-this-invalid.test |  5 +++++
 4 files changed, 28 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3ea602a23..4e2110400 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -418,6 +418,7 @@ TESTS = \
        delegates/instance-method-to-no-target-2.test \
        delegates/lambda-incompatible.test \
        delegates/lambda-mixed-instance-static.vala \
+       delegates/lambda-outer-constant.test \
        delegates/lambda-shared-closure.vala \
        delegates/member-target-destroy.vala \
        delegates/params-array.vala \
@@ -1060,7 +1061,9 @@ TESTS = \
        semantic/member-access-capture-out.test \
        semantic/member-access-capture-valist-parameter.test \
        semantic/member-access-capture-valist-variable.test \
+       semantic/member-access-not-found.test \
        semantic/member-access-protected-invalid.test \
+       semantic/member-access-this-invalid.test \
        semantic/member-access-undefined.test \
        semantic/member-access-static-with-instance.vala \
        semantic/member-access-static-transformed-qualified.vala \
diff --git a/tests/delegates/lambda-outer-constant.test b/tests/delegates/lambda-outer-constant.test
new file mode 100644
index 000000000..51251fa06
--- /dev/null
+++ b/tests/delegates/lambda-outer-constant.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+delegate void FooFunc ();
+
+void main () {
+       const int FOO = 23;
+
+       FooFunc foo = () => {
+               var i = FOO;
+       };
+}
diff --git a/tests/semantic/member-access-not-found.test b/tests/semantic/member-access-not-found.test
new file mode 100644
index 000000000..8fb096fda
--- /dev/null
+++ b/tests/semantic/member-access-not-found.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+class Foo {
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.get_bar ();
+}
diff --git a/tests/semantic/member-access-this-invalid.test b/tests/semantic/member-access-this-invalid.test
new file mode 100644
index 000000000..39162245b
--- /dev/null
+++ b/tests/semantic/member-access-this-invalid.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       var foo = this;
+}


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