summaryrefslogtreecommitdiff
path: root/tests/semantic
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-10-23 15:27:12 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2021-10-23 15:27:12 +0200
commit28ef85c514bb64287c441bfc1f649589d9dde694 (patch)
tree6cba2db02dd59ddf9e7e233df883dc602f3c3a5d /tests/semantic
parent4a1fe512404de175528e533354e36b811903390d (diff)
downloadvala-28ef85c514bb64287c441bfc1f649589d9dde694.tar.gz
tests: Add more invalid "(un)lock" tests to increase coverage
Diffstat (limited to 'tests/semantic')
-rw-r--r--tests/semantic/lock-not-current-class.test14
-rw-r--r--tests/semantic/lock-not-lockable.test8
-rw-r--r--tests/semantic/unlock-not-current-class.test14
-rw-r--r--tests/semantic/unlock-not-lockable.test8
4 files changed, 44 insertions, 0 deletions
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);
+}