]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix test of previous commit a6df1b9
authorLuca Bruno <lucabru@src.gnome.org>
Mon, 22 Dec 2014 09:18:00 +0000 (10:18 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 22 Dec 2014 09:18:00 +0000 (10:18 +0100)
tests/basic-types/bug731017.vala

index 0b1e0ac379d4147e5770845e9a8f852d17877b23..4f25205a725abc06a50486a6a9fc415e41bcb179 100644 (file)
@@ -1,17 +1,18 @@
-[CCode (cname = "g_hash_table_get_keys_as_array", array_length_type = "guint", type = "gpointer*")]
-public extern (unowned string)[] g_hash_table_get_keys_as_array (GLib.HashTable<string,string> hash_table);
+string foo = null;
 
-private static int main (string[] args) {
-  var ht = new GLib.HashTable<string,string> (GLib.str_hash, GLib.str_equal);
-  ht["one"] = "hello";
-  ht["two"] = "world";
+(unowned string)[] bar () {
+       (unowned string)[] ret = new (unowned string)[1];
+       ret[0] = foo;
+       return ret;
+}
 
-  string[] keys = g_hash_table_get_keys_as_array (ht);
-  ht = null;
-  
-  foreach (unowned string k in keys) {
-         assert (k == "one" || k == "two");
-  }
-
-  return 0;
+void main() {
+       foo = "foo";
+       
+       string[] keys = bar();
+       foo = null;
+       
+       foreach (unowned string k in keys) {
+               assert (k == "foo");
+       }
 }
\ No newline at end of file