]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add more method tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 17 May 2023 20:40:53 +0000 (22:40 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 21 May 2023 10:24:14 +0000 (12:24 +0200)
tests/Makefile.am
tests/semantic/method-override-no-class.test [new file with mode: 0644]
tests/semantic/method-virtual-no-class-or-interface.test [new file with mode: 0644]

index b4663353e0045e70cd471a4008d2117e0166da91..76a9c7435123e3d6a681fc0e5a55e93ec7898e14 100644 (file)
@@ -1208,6 +1208,7 @@ TESTS = \
        semantic/method-main-inline.test \
        semantic/method-main-throws.test \
        semantic/method-override.test \
+       semantic/method-override-no-class.test \
        semantic/method-postcondition.test \
        semantic/method-precondition.test \
        semantic/method-private-abstract.test \
@@ -1223,6 +1224,7 @@ TESTS = \
        semantic/method-too-many-type-arguments.test \
        semantic/method-virtual.test \
        semantic/method-virtual-body.test \
+       semantic/method-virtual-no-class-or-interface.test \
        semantic/methodcall-field-initializer-throws.test \
        semantic/methodcall-invalid-argument-lambda.test \
        semantic/methodcall-invocation-invalid.test \
diff --git a/tests/semantic/method-override-no-class.test b/tests/semantic/method-override-no-class.test
new file mode 100644 (file)
index 0000000..f881aa4
--- /dev/null
@@ -0,0 +1,14 @@
+Invalid Code
+
+class Foo {
+       public virtual void foo () {
+       }
+}
+
+interface Bar : Foo {
+       public override void foo () {
+       }
+}
+
+void main () {
+}
diff --git a/tests/semantic/method-virtual-no-class-or-interface.test b/tests/semantic/method-virtual-no-class-or-interface.test
new file mode 100644 (file)
index 0000000..6b1161f
--- /dev/null
@@ -0,0 +1,11 @@
+Invalid Code
+
+struct Foo {
+       public int i;
+
+       public virtual void foo () {
+       }
+}
+
+void main () {
+}