]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "GenericAccessors" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 21 Sep 2018 13:48:12 +0000 (15:48 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 21 Sep 2018 13:51:18 +0000 (15:51 +0200)
tests/Makefile.am
tests/generics/bug640330.test [new file with mode: 0644]
tests/generics/bug640330.vala [new file with mode: 0644]

index 3bc8baa52c0d04be195d686827140d27ec2d53b2..f4c0372e066cb5e979945dfeb6f07304a5230e17 100644 (file)
@@ -376,6 +376,8 @@ TESTS = \
        asynchronous/closures.vala \
        asynchronous/generator.vala \
        asynchronous/yield.vala \
+       generics/bug640330.test \
+       generics/bug640330.vala \
        generics/bug694765-1.vala \
        generics/bug694765-2.vala \
        generics/bug694765-3.vala \
diff --git a/tests/generics/bug640330.test b/tests/generics/bug640330.test
new file mode 100644 (file)
index 0000000..525cf8e
--- /dev/null
@@ -0,0 +1,13 @@
+Invalid Code
+
+interface Foo<G> : Object {
+       public virtual G get_foo (G g) {
+               return g;
+       }
+}
+
+class Bar<G> : Object, Foo<G> {
+}
+
+void main () {
+}
diff --git a/tests/generics/bug640330.vala b/tests/generics/bug640330.vala
new file mode 100644 (file)
index 0000000..44c5cd9
--- /dev/null
@@ -0,0 +1,14 @@
+[GenericAccessors]
+interface Foo<G> : Object {
+       public virtual G get_foo (G g) {
+               return g;
+       }
+}
+
+class Bar<G> : Object, Foo<G> {
+}
+
+void main () {
+       var bar = new Bar<string> ();
+       assert ("foo" == bar.get_foo ("foo"));
+}