]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add more invalid "(un)lock" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Oct 2021 13:27:12 +0000 (15:27 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Oct 2021 12:50:11 +0000 (14:50 +0200)
tests/Makefile.am
tests/semantic/lock-not-current-class.test [new file with mode: 0644]
tests/semantic/lock-not-lockable.test [new file with mode: 0644]
tests/semantic/unlock-not-current-class.test [new file with mode: 0644]
tests/semantic/unlock-not-lockable.test [new file with mode: 0644]

index 88d5d959d44bd78aa28d82157d4cc03f87b34bcf..f26ef8a5a3360a09d6d7386b0a9f4e6d7a928d86 100644 (file)
@@ -1007,6 +1007,8 @@ TESTS = \
        semantic/localvariable-var-static-access-instance-property.test \
        semantic/localvariable-var-without-initializer.test \
        semantic/localvariable-void.test \
+       semantic/lock-not-current-class.test \
+       semantic/lock-not-lockable.test \
        semantic/member-access-async-callback-invalid.test \
        semantic/member-access-capture-out.test \
        semantic/member-access-capture-valist-parameter.test \
@@ -1120,6 +1122,8 @@ TESTS = \
        semantic/unary-unsupported-minus.test \
        semantic/unary-unsupported-negation.test \
        semantic/unary-unsupported-out-ref.test \
+       semantic/unlock-not-current-class.test \
+       semantic/unlock-not-lockable.test \
        semantic/yield-call-requires-async-context.test \
        semantic/yield-call-requires-async-method.test \
        semantic/yield-call-requires-async-method-2.test \
diff --git a/tests/semantic/lock-not-current-class.test b/tests/semantic/lock-not-current-class.test
new file mode 100644 (file)
index 0000000..3bc6673
--- /dev/null
@@ -0,0 +1,14 @@
+Invalid Code
+
+class Bar {
+       public int bar;
+}
+
+class Foo {
+       void foo (Bar bar) {
+               lock (bar.bar);
+       }
+}
+
+void main () {
+}
diff --git a/tests/semantic/lock-not-lockable.test b/tests/semantic/lock-not-lockable.test
new file mode 100644 (file)
index 0000000..d7e3a0a
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo () {
+}
+
+void main () {
+       lock (foo);
+}
diff --git a/tests/semantic/unlock-not-current-class.test b/tests/semantic/unlock-not-current-class.test
new file mode 100644 (file)
index 0000000..eae24f2
--- /dev/null
@@ -0,0 +1,14 @@
+Invalid Code
+
+class Bar {
+       public int bar;
+}
+
+class Foo {
+       void foo (Bar bar) {
+               unlock (bar.bar);
+       }
+}
+
+void main () {
+}
diff --git a/tests/semantic/unlock-not-lockable.test b/tests/semantic/unlock-not-lockable.test
new file mode 100644 (file)
index 0000000..bb0a230
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo () {
+}
+
+void main () {
+       unlock (foo);
+}