From: Luca Bruno Date: Mon, 22 Dec 2014 09:18:00 +0000 (+0100) Subject: Fix test of previous commit a6df1b9 X-Git-Tag: 0.27.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8b8cae8cabc2ba7ceb9629cde5b530d997ef89c;p=thirdparty%2Fvala.git Fix test of previous commit a6df1b9 --- diff --git a/tests/basic-types/bug731017.vala b/tests/basic-types/bug731017.vala index 0b1e0ac37..4f25205a7 100644 --- a/tests/basic-types/bug731017.vala +++ b/tests/basic-types/bug731017.vala @@ -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 hash_table); +string foo = null; -private static int main (string[] args) { - var ht = new GLib.HashTable (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