[vala/staging] tests: Add some "unary expressions" tests to increase coverage



commit 0d5f3eefac6df8c009fca0b7243d66dcad3465ce
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 27 12:23:56 2021 +0100

    tests: Add some "unary expressions" tests to increase coverage

 tests/Makefile.am                                     |  2 ++
 .../unary-invalid-instance-member-access.test         |  9 +++++++++
 tests/semantic/unary-unsupported-out-ref.test         | 19 +++++++++++++++++++
 3 files changed, 30 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2ea1cb3fb..fe064e2f8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1080,10 +1080,12 @@ TESTS = \
        semantic/throw-no-error-type.test \
        semantic/throw-unknown-error-type.test \
        semantic/type-argument-ownership-mismatch.test \
+       semantic/unary-invalid-instance-member-access.test \
        semantic/unary-unsupported-complement.test \
        semantic/unary-unsupported-increment.test \
        semantic/unary-unsupported-minus.test \
        semantic/unary-unsupported-negation.test \
+       semantic/unary-unsupported-out-ref.test \
        semantic/with-array.test \
        semantic/with-buildin.vala \
        semantic/with-class.test \
diff --git a/tests/semantic/unary-invalid-instance-member-access.test 
b/tests/semantic/unary-invalid-instance-member-access.test
new file mode 100644
index 000000000..7e857867f
--- /dev/null
+++ b/tests/semantic/unary-invalid-instance-member-access.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+class Foo {
+       public bool bar;
+}
+
+void main () {
+       assert (!Foo.bar);
+}
diff --git a/tests/semantic/unary-unsupported-out-ref.test b/tests/semantic/unary-unsupported-out-ref.test
new file mode 100644
index 000000000..21f2ba64c
--- /dev/null
+++ b/tests/semantic/unary-unsupported-out-ref.test
@@ -0,0 +1,19 @@
+Invalid Code
+
+class Foo {
+       public string bar { get; set; }
+}
+
+void manam (out string s) {
+       s = "manam";
+}
+
+void minim (ref string s) {
+       s = "minim";
+}
+
+void main () {
+       var foo = new Foo ();
+       manam (out foo.bar);
+       minim (ref foo.bar);
+}


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