]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add some "unary expressions" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 11:23:56 +0000 (12:23 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 19:26:43 +0000 (20:26 +0100)
tests/Makefile.am
tests/semantic/unary-invalid-instance-member-access.test [new file with mode: 0644]
tests/semantic/unary-unsupported-out-ref.test [new file with mode: 0644]

index 4594b47f84ff269ea8d6f978a57459d5bade9339..d32c502df2b213be97930c520374618b528a258e 100644 (file)
@@ -1063,10 +1063,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 (file)
index 0000000..7e85786
--- /dev/null
@@ -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 (file)
index 0000000..21f2ba6
--- /dev/null
@@ -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);
+}