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



commit e248bc0bc370bbfe011757d41c80baba5e3d2df0
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 88d5d959d..f26ef8a5a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
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]