[vala/0.52] tests: Add more invalid "(un)lock" tests to increase coverage



commit 3b3220f272e807d44596f74d36d436ca8e9b2229
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Oct 23 15:27:12 2021 +0200

    tests: Add more invalid "(un)lock" tests to increase coverage

 tests/Makefile.am                            |  4 ++++
 tests/semantic/lock-not-current-class.test   | 14 ++++++++++++++
 tests/semantic/lock-not-lockable.test        |  8 ++++++++
 tests/semantic/unlock-not-current-class.test | 14 ++++++++++++++
 tests/semantic/unlock-not-lockable.test      |  8 ++++++++
 5 files changed, 48 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 614b36a7c..b7d710301 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1046,6 +1046,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 \
@@ -1159,6 +1161,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
index 000000000..3bc6673ea
--- /dev/null
+++ b/tests/semantic/lock-not-current-class.test
@@ -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
index 000000000..d7e3a0a97
--- /dev/null
+++ b/tests/semantic/lock-not-lockable.test
@@ -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
index 000000000..eae24f23c
--- /dev/null
+++ b/tests/semantic/unlock-not-current-class.test
@@ -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
index 000000000..bb0a23046
--- /dev/null
+++ b/tests/semantic/unlock-not-lockable.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo () {
+}
+
+void main () {
+       unlock (foo);
+}


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