diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-02-28 12:29:16 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-02-28 12:29:16 +0100 |
commit | 97d6ffb154ce0afab2bafb81b824ff7faadb66fa (patch) | |
tree | c474d7a975cabcb1d16b0f1ea2d64906cab9cb45 /tests | |
parent | 4c804623b43531bd90a28d7edf62e7fde08c7381 (diff) | |
download | vala-97d6ffb154ce0afab2bafb81b824ff7faadb66fa.tar.gz |
Require and target GLib >= 2.56
The next stable release of vala will happen over 5 years after the
release of GLib 2.56.0.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1415
Diffstat (limited to 'tests')
-rw-r--r-- | tests/annotations/description.c-expected | 8 | ||||
-rw-r--r-- | tests/basic-types/gptrarray.c-expected | 464 | ||||
-rw-r--r-- | tests/basic-types/gptrarray.vala | 4 | ||||
-rw-r--r-- | tests/dbus/async-no-reply_client.c-expected | 12 | ||||
-rw-r--r-- | tests/dbus/no-reply_client.c-expected | 12 | ||||
-rw-r--r-- | tests/enums/bug614424.c-expected | 6 | ||||
-rw-r--r-- | tests/enums/bug763831.c-expected | 14 | ||||
-rw-r--r-- | tests/objects/plugin-module-init.c-expected | 14 | ||||
-rw-r--r-- | tests/parser/preprocessor-glib.vala | 8 |
9 files changed, 299 insertions, 243 deletions
diff --git a/tests/annotations/description.c-expected b/tests/annotations/description.c-expected index e2d01d7a5..b99ec456e 100644 --- a/tests/annotations/description.c-expected +++ b/tests/annotations/description.c-expected @@ -37,6 +37,7 @@ typedef enum { } Bar; #define TYPE_BAR (bar_get_type ()) +#define _g_free0(var) (var = (g_free (var), NULL)) #define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); @@ -244,7 +245,7 @@ _vala_main (void) gint _tmp5__length1; GTypeClass* _tmp12_; GEnumClass* _tmp13_; - GEnumValue* _tmp14_; + gchar* _tmp14_; const gchar* _tmp15_; _tmp0_ = foo_new (); foo = _tmp0_; @@ -287,9 +288,10 @@ _vala_main (void) } _tmp12_ = g_type_class_ref (TYPE_BAR); _tmp13_ = (GEnumClass*) _tmp12_; - _tmp14_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_FOO); - _tmp15_ = (*g_enum_get_value_by_name (_tmp13_, (_tmp14_ != NULL) ? _tmp14_->value_name : NULL)).value_nick; + _tmp14_ = g_enum_to_string (TYPE_BAR, BAR_FOO); + _tmp15_ = (*g_enum_get_value_by_name (_tmp13_, _tmp14_)).value_nick; _vala_assert (g_strcmp0 (_tmp15_, "foo's nick") == 0, "((EnumClass) typeof (Bar).class_ref ()).get_value_by_name (Bar.FOO.to_string ()).value_nick == \"foo's nick\""); + _g_free0 (_tmp14_); _g_type_class_unref0 (_tmp13_); properties = (g_free (properties), NULL); _g_object_unref0 (foo); diff --git a/tests/basic-types/gptrarray.c-expected b/tests/basic-types/gptrarray.c-expected index 88df05aef..bc641afa3 100644 --- a/tests/basic-types/gptrarray.c-expected +++ b/tests/basic-types/gptrarray.c-expected @@ -342,16 +342,16 @@ _vala_main (void) Foo* _tmp3_; Foo* foo5 = NULL; Foo* _tmp4_; - Foo* _tmp76_; - Foo* _tmp77_; - Foo* _tmp78_; - Foo* _tmp79_; - Foo* _tmp80_; - Foo* _tmp147_; - Foo* _tmp148_; - Foo* _tmp149_; - Foo* _tmp150_; - Foo* _tmp151_; + Foo* _tmp84_; + Foo* _tmp85_; + Foo* _tmp86_; + Foo* _tmp87_; + Foo* _tmp88_; + Foo* _tmp163_; + Foo* _tmp164_; + Foo* _tmp165_; + Foo* _tmp166_; + Foo* _tmp167_; _tmp0_ = foo_new (5); foo1 = _tmp0_; _tmp1_ = foo_new (4); @@ -410,15 +410,24 @@ _vala_main (void) GPtrArray* _tmp64_; gint _tmp65_; gint _tmp66_; + guint index = 0U; GPtrArray* _tmp67_; - GPtrArray* _tmp68_; - GPtrArray* _tmp69_; - gint _tmp70_; - gint _tmp71_; + Foo* _tmp68_; + guint _tmp69_ = 0U; + gboolean _tmp70_; + Foo* _tmp71_; GPtrArray* _tmp72_; - GPtrArray* _tmp73_; + gint _tmp73_; gint _tmp74_; - gint _tmp75_; + GPtrArray* _tmp75_; + GPtrArray* _tmp76_; + GPtrArray* _tmp77_; + gint _tmp78_; + gint _tmp79_; + GPtrArray* _tmp80_; + GPtrArray* _tmp81_; + gint _tmp82_; + gint _tmp83_; _tmp5_ = g_ptr_array_new_full ((guint) 8, _g_object_unref0_); array = _tmp5_; _tmp6_ = array; @@ -588,146 +597,167 @@ _vala_main (void) _tmp66_ = _tmp65_; _vala_assert (_tmp66_ == 3, "array.length == 3"); _tmp67_ = array; - vala_g_ptr_array_sort (_tmp67_, _compare_foo_gcompare_func); - _tmp68_ = array; - vala_g_ptr_array_sort_with_data (_tmp68_, _compare_foo_gcompare_data_func, NULL); - _tmp69_ = array; - _tmp70_ = vala_g_ptr_array_get_length (_tmp69_); - _tmp71_ = _tmp70_; - _vala_assert (_tmp71_ == 3, "array.length == 3"); + _tmp68_ = foo5; + _tmp70_ = g_ptr_array_find (_tmp67_, _tmp68_, &_tmp69_); + index = _tmp69_; + _vala_assert (_tmp70_, "array.find (foo5, out index)"); + _tmp71_ = foo5; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp71_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "foo5.ref_count == 2"); + _vala_assert (index == ((guint) 1), "index == 1"); _tmp72_ = array; - g_ptr_array_set_size (_tmp72_, 0); - _tmp73_ = array; - _tmp74_ = vala_g_ptr_array_get_length (_tmp73_); - _tmp75_ = _tmp74_; - _vala_assert (_tmp75_ == 0, "array.length == 0"); + _tmp73_ = vala_g_ptr_array_get_length (_tmp72_); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 3, "array.length == 3"); + _tmp75_ = array; + vala_g_ptr_array_sort (_tmp75_, _compare_foo_gcompare_func); + _tmp76_ = array; + vala_g_ptr_array_sort_with_data (_tmp76_, _compare_foo_gcompare_data_func, NULL); + _tmp77_ = array; + _tmp78_ = vala_g_ptr_array_get_length (_tmp77_); + _tmp79_ = _tmp78_; + _vala_assert (_tmp79_ == 3, "array.length == 3"); + _tmp80_ = array; + g_ptr_array_set_size (_tmp80_, 0); + _tmp81_ = array; + _tmp82_ = vala_g_ptr_array_get_length (_tmp81_); + _tmp83_ = _tmp82_; + _vala_assert (_tmp83_ == 0, "array.length == 0"); _g_ptr_array_unref0 (array); } - _tmp76_ = foo1; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); - _tmp77_ = foo2; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp77_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); - _tmp78_ = foo3; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp78_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); - _tmp79_ = foo4; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp79_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); - _tmp80_ = foo5; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp80_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); + _tmp84_ = foo1; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); + _tmp85_ = foo2; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp85_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); + _tmp86_ = foo3; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp86_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); + _tmp87_ = foo4; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); + _tmp88_ = foo5; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp88_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); { GPtrArray* array = NULL; - GPtrArray* _tmp81_; - GPtrArray* _tmp82_; - Foo* _tmp83_; - Foo* _tmp84_; - GPtrArray* _tmp85_; - Foo* _tmp86_; - Foo* _tmp87_; - GPtrArray* _tmp88_; - Foo* _tmp89_; - Foo* _tmp90_; - GPtrArray* _tmp91_; - gint _tmp92_; - gint _tmp93_; + GPtrArray* _tmp89_; + GPtrArray* _tmp90_; + Foo* _tmp91_; + Foo* _tmp92_; + GPtrArray* _tmp93_; + Foo* _tmp94_; + Foo* _tmp95_; + GPtrArray* _tmp96_; + Foo* _tmp97_; + Foo* _tmp98_; + GPtrArray* _tmp99_; + gint _tmp100_; + gint _tmp101_; gint loop_size = 0; - GPtrArray* _tmp94_; - GPtrArray* _tmp103_; - Foo* _tmp113_; - GPtrArray* _tmp114_; - gconstpointer _tmp115_; - GPtrArray* _tmp116_; - Foo* _tmp117_; - Foo* _tmp118_; - GPtrArray* _tmp119_; - gconstpointer _tmp120_; + GPtrArray* _tmp102_; + GPtrArray* _tmp111_; Foo* _tmp121_; - Foo* _tmp122_; - GPtrArray* _tmp123_; - gint _tmp124_; - gint _tmp125_; - GPtrArray* _tmp126_; - Foo* _tmp127_; - Foo* _tmp128_; - GPtrArray* _tmp129_; - gint _tmp130_; - gint _tmp131_; - GPtrArray* _tmp132_; - Foo* _tmp133_; - Foo* _tmp134_; - GPtrArray* _tmp135_; - gint _tmp136_; - gint _tmp137_; - GPtrArray* _tmp138_; - GPtrArray* _tmp139_; + GPtrArray* _tmp122_; + gconstpointer _tmp123_; + GPtrArray* _tmp124_; + Foo* _tmp125_; + Foo* _tmp126_; + GPtrArray* _tmp127_; + gconstpointer _tmp128_; + Foo* _tmp129_; + Foo* _tmp130_; + GPtrArray* _tmp131_; + gint _tmp132_; + gint _tmp133_; + GPtrArray* _tmp134_; + Foo* _tmp135_; + Foo* _tmp136_; + GPtrArray* _tmp137_; + gint _tmp138_; + gint _tmp139_; GPtrArray* _tmp140_; - gint _tmp141_; - gint _tmp142_; + Foo* _tmp141_; + Foo* _tmp142_; GPtrArray* _tmp143_; - GPtrArray* _tmp144_; + gint _tmp144_; gint _tmp145_; - gint _tmp146_; - _tmp81_ = g_ptr_array_new_full ((guint) 8, NULL); - array = _tmp81_; - _tmp82_ = array; - _tmp83_ = foo1; - g_ptr_array_add (_tmp82_, _tmp83_); - _tmp84_ = foo1; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); - _tmp85_ = array; - _tmp86_ = foo2; - g_ptr_array_add (_tmp85_, _tmp86_); - _tmp87_ = foo2; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); - _tmp88_ = array; - _tmp89_ = foo3; - g_ptr_array_add (_tmp88_, _tmp89_); - _tmp90_ = foo3; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp90_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); - _tmp91_ = array; - _tmp92_ = vala_g_ptr_array_get_length (_tmp91_); - _tmp93_ = _tmp92_; - _vala_assert (_tmp93_ == 3, "array.length == 3"); + guint index = 0U; + GPtrArray* _tmp146_; + Foo* _tmp147_; + guint _tmp148_ = 0U; + gboolean _tmp149_; + Foo* _tmp150_; + GPtrArray* _tmp151_; + gint _tmp152_; + gint _tmp153_; + GPtrArray* _tmp154_; + GPtrArray* _tmp155_; + GPtrArray* _tmp156_; + gint _tmp157_; + gint _tmp158_; + GPtrArray* _tmp159_; + GPtrArray* _tmp160_; + gint _tmp161_; + gint _tmp162_; + _tmp89_ = g_ptr_array_new_full ((guint) 8, NULL); + array = _tmp89_; + _tmp90_ = array; + _tmp91_ = foo1; + g_ptr_array_add (_tmp90_, _tmp91_); + _tmp92_ = foo1; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp92_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); + _tmp93_ = array; + _tmp94_ = foo2; + g_ptr_array_add (_tmp93_, _tmp94_); + _tmp95_ = foo2; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp95_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); + _tmp96_ = array; + _tmp97_ = foo3; + g_ptr_array_add (_tmp96_, _tmp97_); + _tmp98_ = foo3; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp98_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); + _tmp99_ = array; + _tmp100_ = vala_g_ptr_array_get_length (_tmp99_); + _tmp101_ = _tmp100_; + _vala_assert (_tmp101_ == 3, "array.length == 3"); loop_size = 0; - _tmp94_ = array; + _tmp102_ = array; { GPtrArray* element_collection = NULL; guint element_index = 0U; - element_collection = _tmp94_; + element_collection = _tmp102_; for (element_index = 0; element_index < element_collection->len; element_index = element_index + 1) { Foo* element = NULL; element = g_ptr_array_index (element_collection, element_index); { - gint _tmp95_; - Foo* _tmp96_; - _tmp95_ = loop_size; - loop_size = _tmp95_ + 1; - _tmp96_ = element; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp96_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "element.ref_count == 1"); + gint _tmp103_; + Foo* _tmp104_; + _tmp103_ = loop_size; + loop_size = _tmp103_ + 1; + _tmp104_ = element; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp104_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "element.ref_count == 1"); switch (loop_size) { case 1: { - Foo* _tmp97_; - Foo* _tmp98_; - _tmp97_ = element; - _tmp98_ = foo1; - _vala_assert (_tmp97_ == _tmp98_, "element == foo1"); + Foo* _tmp105_; + Foo* _tmp106_; + _tmp105_ = element; + _tmp106_ = foo1; + _vala_assert (_tmp105_ == _tmp106_, "element == foo1"); break; } case 2: { - Foo* _tmp99_; - Foo* _tmp100_; - _tmp99_ = element; - _tmp100_ = foo2; - _vala_assert (_tmp99_ == _tmp100_, "element == foo2"); + Foo* _tmp107_; + Foo* _tmp108_; + _tmp107_ = element; + _tmp108_ = foo2; + _vala_assert (_tmp107_ == _tmp108_, "element == foo2"); break; } case 3: { - Foo* _tmp101_; - Foo* _tmp102_; - _tmp101_ = element; - _tmp102_ = foo3; - _vala_assert (_tmp101_ == _tmp102_, "element == foo3"); + Foo* _tmp109_; + Foo* _tmp110_; + _tmp109_ = element; + _tmp110_ = foo3; + _vala_assert (_tmp109_ == _tmp110_, "element == foo3"); break; } default: @@ -738,49 +768,49 @@ _vala_main (void) } _vala_assert (loop_size == 3, "loop_size == 3"); loop_size = 0; - _tmp103_ = array; + _tmp111_ = array; { GPtrArray* element_collection = NULL; guint element_index = 0U; - element_collection = _tmp103_; + element_collection = _tmp111_; for (element_index = 0; element_index < element_collection->len; element_index = element_index + 1) { - Foo* _tmp104_; + Foo* _tmp112_; Foo* element = NULL; - _tmp104_ = _g_object_ref0 (g_ptr_array_index (element_collection, element_index)); - element = _tmp104_; + _tmp112_ = _g_object_ref0 (g_ptr_array_index (element_collection, element_index)); + element = _tmp112_; { - gint _tmp105_; - Foo* _tmp106_; - _tmp105_ = loop_size; - loop_size = _tmp105_ + 1; - _tmp106_ = element; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp106_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "element.ref_count == 2"); + gint _tmp113_; + Foo* _tmp114_; + _tmp113_ = loop_size; + loop_size = _tmp113_ + 1; + _tmp114_ = element; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp114_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "element.ref_count == 2"); switch (loop_size) { case 1: { - Foo* _tmp107_; - Foo* _tmp108_; - _tmp107_ = element; - _tmp108_ = foo1; - _vala_assert (_tmp107_ == _tmp108_, "element == foo1"); + Foo* _tmp115_; + Foo* _tmp116_; + _tmp115_ = element; + _tmp116_ = foo1; + _vala_assert (_tmp115_ == _tmp116_, "element == foo1"); break; } case 2: { - Foo* _tmp109_; - Foo* _tmp110_; - _tmp109_ = element; - _tmp110_ = foo2; - _vala_assert (_tmp109_ == _tmp110_, "element == foo2"); + Foo* _tmp117_; + Foo* _tmp118_; + _tmp117_ = element; + _tmp118_ = foo2; + _vala_assert (_tmp117_ == _tmp118_, "element == foo2"); break; } case 3: { - Foo* _tmp111_; - Foo* _tmp112_; - _tmp111_ = element; - _tmp112_ = foo3; - _vala_assert (_tmp111_ == _tmp112_, "element == foo3"); + Foo* _tmp119_; + Foo* _tmp120_; + _tmp119_ = element; + _tmp120_ = foo3; + _vala_assert (_tmp119_ == _tmp120_, "element == foo3"); break; } default: @@ -791,69 +821,81 @@ _vala_main (void) } } _vala_assert (loop_size == 3, "loop_size == 3"); - _tmp113_ = foo2; - _tmp114_ = array; - _tmp115_ = g_ptr_array_index (_tmp114_, (guint) 1); - _vala_assert (_tmp113_ == ((Foo*) _tmp115_), "foo2 == array.get (1)"); - _tmp116_ = array; - _tmp117_ = foo4; - g_ptr_array_set (_tmp116_, (guint) 1, _tmp117_); - _tmp118_ = foo4; - _tmp119_ = array; - _tmp120_ = g_ptr_array_index (_tmp119_, (guint) 1); - _vala_assert (_tmp118_ == ((Foo*) _tmp120_), "foo4 == array.get (1)"); _tmp121_ = foo2; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp121_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); - _tmp122_ = foo4; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp122_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); - _tmp123_ = array; - _tmp124_ = vala_g_ptr_array_get_length (_tmp123_); - _tmp125_ = _tmp124_; - _vala_assert (_tmp125_ == 3, "array.length == 3"); - _tmp126_ = array; - _tmp127_ = foo5; - g_ptr_array_insert (_tmp126_, 2, _tmp127_); - _tmp128_ = foo5; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp128_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); - _tmp129_ = array; - _tmp130_ = vala_g_ptr_array_get_length (_tmp129_); - _tmp131_ = _tmp130_; - _vala_assert (_tmp131_ == 4, "array.length == 4"); - _tmp132_ = array; - _tmp133_ = foo4; - _vala_assert (g_ptr_array_remove (_tmp132_, _tmp133_), "array.remove (foo4)"); - _tmp134_ = foo4; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp134_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); - _tmp135_ = array; - _tmp136_ = vala_g_ptr_array_get_length (_tmp135_); - _tmp137_ = _tmp136_; - _vala_assert (_tmp137_ == 3, "array.length == 3"); - _tmp138_ = array; - vala_g_ptr_array_sort (_tmp138_, _compare_foo_gcompare_func); - _tmp139_ = array; - vala_g_ptr_array_sort_with_data (_tmp139_, _compare_foo_gcompare_data_func, NULL); + _tmp122_ = array; + _tmp123_ = g_ptr_array_index (_tmp122_, (guint) 1); + _vala_assert (_tmp121_ == ((Foo*) _tmp123_), "foo2 == array.get (1)"); + _tmp124_ = array; + _tmp125_ = foo4; + g_ptr_array_set (_tmp124_, (guint) 1, _tmp125_); + _tmp126_ = foo4; + _tmp127_ = array; + _tmp128_ = g_ptr_array_index (_tmp127_, (guint) 1); + _vala_assert (_tmp126_ == ((Foo*) _tmp128_), "foo4 == array.get (1)"); + _tmp129_ = foo2; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp129_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); + _tmp130_ = foo4; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp130_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); + _tmp131_ = array; + _tmp132_ = vala_g_ptr_array_get_length (_tmp131_); + _tmp133_ = _tmp132_; + _vala_assert (_tmp133_ == 3, "array.length == 3"); + _tmp134_ = array; + _tmp135_ = foo5; + g_ptr_array_insert (_tmp134_, 2, _tmp135_); + _tmp136_ = foo5; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp136_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); + _tmp137_ = array; + _tmp138_ = vala_g_ptr_array_get_length (_tmp137_); + _tmp139_ = _tmp138_; + _vala_assert (_tmp139_ == 4, "array.length == 4"); _tmp140_ = array; - _tmp141_ = vala_g_ptr_array_get_length (_tmp140_); - _tmp142_ = _tmp141_; - _vala_assert (_tmp142_ == 3, "array.length == 3"); + _tmp141_ = foo4; + _vala_assert (g_ptr_array_remove (_tmp140_, _tmp141_), "array.remove (foo4)"); + _tmp142_ = foo4; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp142_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); _tmp143_ = array; - g_ptr_array_set_size (_tmp143_, 0); - _tmp144_ = array; - _tmp145_ = vala_g_ptr_array_get_length (_tmp144_); - _tmp146_ = _tmp145_; - _vala_assert (_tmp146_ == 0, "array.length == 0"); + _tmp144_ = vala_g_ptr_array_get_length (_tmp143_); + _tmp145_ = _tmp144_; + _vala_assert (_tmp145_ == 3, "array.length == 3"); + _tmp146_ = array; + _tmp147_ = foo5; + _tmp149_ = g_ptr_array_find (_tmp146_, _tmp147_, &_tmp148_); + index = _tmp148_; + _vala_assert (_tmp149_, "array.find (foo5, out index)"); + _tmp150_ = foo5; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); + _vala_assert (index == ((guint) 1), "index == 1"); + _tmp151_ = array; + _tmp152_ = vala_g_ptr_array_get_length (_tmp151_); + _tmp153_ = _tmp152_; + _vala_assert (_tmp153_ == 3, "array.length == 3"); + _tmp154_ = array; + vala_g_ptr_array_sort (_tmp154_, _compare_foo_gcompare_func); + _tmp155_ = array; + vala_g_ptr_array_sort_with_data (_tmp155_, _compare_foo_gcompare_data_func, NULL); + _tmp156_ = array; + _tmp157_ = vala_g_ptr_array_get_length (_tmp156_); + _tmp158_ = _tmp157_; + _vala_assert (_tmp158_ == 3, "array.length == 3"); + _tmp159_ = array; + g_ptr_array_set_size (_tmp159_, 0); + _tmp160_ = array; + _tmp161_ = vala_g_ptr_array_get_length (_tmp160_); + _tmp162_ = _tmp161_; + _vala_assert (_tmp162_ == 0, "array.length == 0"); _g_ptr_array_unref0 (array); } - _tmp147_ = foo1; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp147_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); - _tmp148_ = foo2; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp148_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); - _tmp149_ = foo3; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp149_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); - _tmp150_ = foo4; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); - _tmp151_ = foo5; - _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp151_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); + _tmp163_ = foo1; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp163_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1"); + _tmp164_ = foo2; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp164_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1"); + _tmp165_ = foo3; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp165_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1"); + _tmp166_ = foo4; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp166_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1"); + _tmp167_ = foo5; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp167_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1"); _g_object_unref0 (foo5); _g_object_unref0 (foo4); _g_object_unref0 (foo3); diff --git a/tests/basic-types/gptrarray.vala b/tests/basic-types/gptrarray.vala index 1b5d6c622..45105db35 100644 --- a/tests/basic-types/gptrarray.vala +++ b/tests/basic-types/gptrarray.vala @@ -65,13 +65,11 @@ void main () { assert (foo4.ref_count == 1); assert (array.length == 3); -#if GLIB_2_54 uint index; assert (array.find (foo5, out index)); assert (foo5.ref_count == 2); assert (index == 1); assert (array.length == 3); -#endif array.sort (compare_foo); array.sort_with_data (compare_foo); @@ -136,13 +134,11 @@ void main () { assert (foo4.ref_count == 1); assert (array.length == 3); -#if GLIB_2_54 uint index; assert (array.find (foo5, out index)); assert (foo5.ref_count == 1); assert (index == 1); assert (array.length == 3); -#endif array.sort (compare_foo); array.sort_with_data (compare_foo); diff --git a/tests/dbus/async-no-reply_client.c-expected b/tests/dbus/async-no-reply_client.c-expected index d865c34a2..f32f69dda 100644 --- a/tests/dbus/async-no-reply_client.c-expected +++ b/tests/dbus/async-no-reply_client.c-expected @@ -753,7 +753,7 @@ __lambda4_ (Block1Data* _data1_, { gboolean _tmp0_ = FALSE; const gchar* _tmp1_; - GDBusMessage* _tmp6_; + GDBusMessage* _tmp4_; GDBusMessage* result; g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL); g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL); @@ -770,12 +770,8 @@ __lambda4_ (Block1Data* _data1_, case G_DBUS_MESSAGE_TYPE_METHOD_CALL: { GAsyncQueue* _tmp3_; - GFlagsValue* _tmp4_; - gchar* _tmp5_; _tmp3_ = _data1_->events; - _tmp4_ = g_flags_get_first_value (g_type_class_ref (g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message)); - _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL); - g_async_queue_push (_tmp3_, _tmp5_); + g_async_queue_push (_tmp3_, g_flags_to_string (g_dbus_message_flags_get_type (), g_dbus_message_get_flags (message))); break; } default: @@ -784,8 +780,8 @@ __lambda4_ (Block1Data* _data1_, } } } - _tmp6_ = _g_object_ref0 (message); - result = _tmp6_; + _tmp4_ = _g_object_ref0 (message); + result = _tmp4_; _g_object_unref0 (message); return result; } diff --git a/tests/dbus/no-reply_client.c-expected b/tests/dbus/no-reply_client.c-expected index 01406da99..1e5800578 100644 --- a/tests/dbus/no-reply_client.c-expected +++ b/tests/dbus/no-reply_client.c-expected @@ -681,7 +681,7 @@ __lambda4_ (Block1Data* _data1_, { gboolean _tmp0_ = FALSE; const gchar* _tmp1_; - GDBusMessage* _tmp6_; + GDBusMessage* _tmp4_; GDBusMessage* result; g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL); g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL); @@ -698,12 +698,8 @@ __lambda4_ (Block1Data* _data1_, case G_DBUS_MESSAGE_TYPE_METHOD_CALL: { GAsyncQueue* _tmp3_; - GFlagsValue* _tmp4_; - gchar* _tmp5_; _tmp3_ = _data1_->events; - _tmp4_ = g_flags_get_first_value (g_type_class_ref (g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message)); - _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL); - g_async_queue_push (_tmp3_, _tmp5_); + g_async_queue_push (_tmp3_, g_flags_to_string (g_dbus_message_flags_get_type (), g_dbus_message_get_flags (message))); break; } default: @@ -712,8 +708,8 @@ __lambda4_ (Block1Data* _data1_, } } } - _tmp6_ = _g_object_ref0 (message); - result = _tmp6_; + _tmp4_ = _g_object_ref0 (message); + result = _tmp4_; _g_object_unref0 (message); return result; } diff --git a/tests/enums/bug614424.c-expected b/tests/enums/bug614424.c-expected index c38fd5949..af50a5a1c 100644 --- a/tests/enums/bug614424.c-expected +++ b/tests/enums/bug614424.c-expected @@ -34,12 +34,8 @@ static void _vala_main (void); gchar* foo_bar (Foo self) { - GEnumValue* _tmp0_; - gchar* _tmp1_; gchar* result; - _tmp0_ = g_enum_get_value (g_type_class_ref (TYPE_FOO), self); - _tmp1_ = g_strdup ((_tmp0_ != NULL) ? _tmp0_->value_name : NULL); - result = _tmp1_; + result = g_enum_to_string (TYPE_FOO, self); return result; } diff --git a/tests/enums/bug763831.c-expected b/tests/enums/bug763831.c-expected index 318d49a94..15c837674 100644 --- a/tests/enums/bug763831.c-expected +++ b/tests/enums/bug763831.c-expected @@ -2,6 +2,9 @@ * generated from enums_bug763831.vala, do not modify */ #include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> #if !defined(VALA_EXTERN) #if defined(_WIN32) || defined(__CYGWIN__) @@ -23,6 +26,7 @@ typedef enum { } Bar; #define TYPE_BAR (bar_get_type ()) +#define _g_free0(var) (var = (g_free (var), NULL)) VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ; @@ -73,10 +77,12 @@ bar_get_type (void) static void _vala_main (void) { - GFlagsValue* _tmp0_; - GEnumValue* _tmp1_; - _tmp0_ = g_flags_get_first_value (g_type_class_ref (TYPE_FOO), FOO_TEST); - _tmp1_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_TEST); + gchar* _tmp0_; + gchar* _tmp1_; + _tmp0_ = g_flags_to_string (TYPE_FOO, FOO_TEST); + _g_free0 (_tmp0_); + _tmp1_ = g_enum_to_string (TYPE_BAR, BAR_TEST); + _g_free0 (_tmp1_); } int diff --git a/tests/objects/plugin-module-init.c-expected b/tests/objects/plugin-module-init.c-expected index de299de94..5788a541d 100644 --- a/tests/objects/plugin-module-init.c-expected +++ b/tests/objects/plugin-module-init.c-expected @@ -29,6 +29,11 @@ enum { MODULE_NUM_PROPERTIES }; static GParamSpec* module_properties[MODULE_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); struct _Module { GTypeModule parent_instance; @@ -129,6 +134,15 @@ init_plugin (GTypeModule* m) static void _vala_main (void) { + GObject* o = NULL; + GObject* _tmp0_; + GObject* _tmp1_; + _tmp0_ = g_object_new (init_plugin (NULL), NULL); + _tmp1_ = G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_; + o = _tmp1_; + _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (o, g_type_module_get_type ()), "o is TypeModule"); + _vala_assert (IS_MODULE (o), "o is Module"); + _g_object_unref0 (o); } int diff --git a/tests/parser/preprocessor-glib.vala b/tests/parser/preprocessor-glib.vala index effc2ecd2..4252547d5 100644 --- a/tests/parser/preprocessor-glib.vala +++ b/tests/parser/preprocessor-glib.vala @@ -35,6 +35,14 @@ void main () { assert_not_reached (); #elif !GLIB_2_48 assert_not_reached (); +#elif !GLIB_2_50 + assert_not_reached (); +#elif !GLIB_2_52 + assert_not_reached (); +#elif !GLIB_2_54 + assert_not_reached (); +#elif !GLIB_2_56 + assert_not_reached (); #else assert (true); #endif |