]> 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>
Sat, 23 Oct 2021 13:27:12 +0000 (15:27 +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 243fc7b5d2fc14149728265046b4b1873aadb829..0edea24ac63a8064ec15233e2d3360d29fc5c5c5 100644 (file)
@@ -1061,6 +1061,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 \
@@ -1174,6 +1176,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/with-array.test \
        semantic/with-buildin.vala \
        semantic/with-class.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);
+}