[vala/staging] tests: Add "GenericAccessors" tests to increase coverage



commit c6059a22b8d52916ad7354bbfd42dfa390c3fa64
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Sep 21 15:48:12 2018 +0200

    tests: Add "GenericAccessors" tests to increase coverage

 tests/Makefile.am             |  2 ++
 tests/generics/bug640330.test | 13 +++++++++++++
 tests/generics/bug640330.vala | 14 ++++++++++++++
 3 files changed, 29 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3bc8baa52..f4c0372e0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 000000000..525cf8e99
--- /dev/null
+++ b/tests/generics/bug640330.test
@@ -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
index 000000000..44c5cd9a5
--- /dev/null
+++ b/tests/generics/bug640330.vala
@@ -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"));
+}


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