diff options
author | Luca Bruno <lucabru@src.gnome.org> | 2014-12-22 10:18:00 +0100 |
---|---|---|
committer | Luca Bruno <lucabru@src.gnome.org> | 2014-12-22 10:18:00 +0100 |
commit | f8b8cae8cabc2ba7ceb9629cde5b530d997ef89c (patch) | |
tree | 28f6c62b36558d2dc9fb4158d107e3b3a0902601 /tests | |
parent | a6df1b95af42610a3c580188976a194ac8383d2a (diff) | |
download | vala-f8b8cae8cabc2ba7ceb9629cde5b530d997ef89c.tar.gz |
Fix test of previous commit a6df1b9
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic-types/bug731017.vala | 29 |
1 files changed, 15 insertions, 14 deletions
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<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 |