]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "generics reference transfer" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 7 May 2021 11:46:28 +0000 (13:46 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 4 Jun 2021 07:19:51 +0000 (09:19 +0200)
tests/generics/reference-transfer.vala

index da2c1e3058e6a87efb97bc1aea034b248d87f074..5dc7a666f0323113b1e259d6ef97b8cc02693016 100644 (file)
@@ -19,6 +19,16 @@ void foo<G> (owned G g) {
 }
 
 void main () {
-       foo<string> ("foo");
-       bar<string> (new Bar<string> ("bar"));
+       {
+               foo<string> ("foo");
+       }
+       {
+               bar<string> (new Bar<string> ("bar"));
+       }
+       {
+               var bar = new Bar<string> ("bar");
+               var t = (owned) bar.g;
+               assert (bar.g == null);
+               assert (t == "bar");
+       }
 }