From 168da22eccacc0627fd7a9dd7420f6972f76586f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 29 Oct 2022 18:23:38 +0100 Subject: test: Add regression test for the new tags --- tests/repository/gitypelibtest.c | 13 + .../Regress.TestSimpleBoxedA.page | 2 +- .../Regress.TestSimpleBoxedA.page | 2 +- .../Regress.TestSimpleBoxedA.page | 2 +- tests/scanner/Regress-1.0-expected.gir | 456 +++++++++++---------- tests/scanner/regress.h | 14 + 6 files changed, 260 insertions(+), 229 deletions(-) diff --git a/tests/repository/gitypelibtest.c b/tests/repository/gitypelibtest.c index c0398d97..b7424a53 100644 --- a/tests/repository/gitypelibtest.c +++ b/tests/repository/gitypelibtest.c @@ -167,6 +167,18 @@ test_fundamental_get_ref_function_pointer (GIRepository * repo) g_base_info_unref (info); } +static void +test_record_get_copy_function (GIRepository *repo) +{ + GIStructInfo *info; + + g_assert_true (g_irepository_require (repo, "Regress", NULL, 0, NULL)); + info = g_irepository_find_by_name (repo, "Regress", "TestBoxedD"); + g_assert_nonnull (info); + g_assert_cmpstr (g_struct_info_get_copy_function (info), ==, "regress_test_boxed_d_copy"); + g_base_info_unref (info); +} + static void test_hash_with_cairo_typelib (GIRepository * repo) { @@ -318,6 +330,7 @@ main (int argc, char **argv) test_size_of_gvalue (repo); test_is_pointer_for_struct_arg (repo); test_fundamental_get_ref_function_pointer (repo); + test_record_get_copy_function (repo); test_hash_with_cairo_typelib (repo); test_char_types (repo); test_signal_array_len (repo); diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestSimpleBoxedA.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestSimpleBoxedA.page index 54570ae1..ce36b0c7 100644 --- a/tests/scanner/Regress-1.0-C-expected/Regress.TestSimpleBoxedA.page +++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestSimpleBoxedA.page @@ -9,7 +9,7 @@ Regress.TestSimpleBoxedA - +

...

some_enum: value }); - +

...

- +

...

Typedef TestBoxed to test caller-allocates correctness - + line="1460">Typedef TestBoxed to test caller-allocates correctness + @@ -33,15 +33,15 @@ and/or use gtk-doc annotations. --> Compatibility typedef, like telepathy-glib's TpIntSet - + line="1430">Compatibility typedef, like telepathy-glib's TpIntSet + Typedef'd GPtrArray for some reason - + line="1438">Typedef'd GPtrArray for some reason + @@ -51,8 +51,8 @@ and/or use gtk-doc annotations. --> Typedef'd va_list for additional reasons - + line="1449">Typedef'd va_list for additional reasons + - + - + - + - + - + @@ -2605,13 +2605,13 @@ exposed to language bindings. - + - + Like telepathy-glib's TpIntset. - + line="1422">Like telepathy-glib's TpIntset. + - + - + @@ -2670,7 +2670,7 @@ exposed to language bindings. - + @@ -2678,7 +2678,7 @@ exposed to language bindings. - + @@ -2695,13 +2695,13 @@ exposed to language bindings. - + - + introspectable="0"> This should be skipped, and moreover, all function which + line="1404">This should be skipped, and moreover, all function which use it should be. - + @@ -2740,7 +2740,7 @@ use it should be. - + @@ -2749,7 +2749,7 @@ use it should be. - + @@ -2758,7 +2758,7 @@ use it should be. - + @@ -2767,7 +2767,7 @@ use it should be. - + @@ -2776,7 +2776,7 @@ use it should be. - + @@ -2785,7 +2785,7 @@ use it should be. - + @@ -2794,7 +2794,7 @@ use it should be. - + @@ -2803,7 +2803,7 @@ use it should be. - + @@ -2812,7 +2812,7 @@ use it should be. - + @@ -2821,7 +2821,7 @@ use it should be. - + @@ -2830,7 +2830,7 @@ use it should be. - + @@ -2839,7 +2839,7 @@ use it should be. - + @@ -2848,7 +2848,7 @@ use it should be. - + @@ -2857,7 +2857,7 @@ use it should be. - + @@ -2866,7 +2866,7 @@ use it should be. - + @@ -2875,7 +2875,7 @@ use it should be. - + @@ -2884,7 +2884,7 @@ use it should be. - + @@ -2893,7 +2893,7 @@ use it should be. - + @@ -2902,7 +2902,7 @@ use it should be. - + @@ -2911,7 +2911,7 @@ use it should be. - + @@ -2920,7 +2920,7 @@ use it should be. - + @@ -2929,7 +2929,7 @@ use it should be. - + @@ -2938,7 +2938,7 @@ use it should be. - + @@ -2978,7 +2978,7 @@ use it should be. glib:type-name="RegressTestBoxed" glib:get-type="regress_test_boxed_get_type" c:symbol-prefix="test_boxed"> - + @@ -2989,14 +2989,14 @@ use it should be. - + - + @@ -3008,7 +3008,7 @@ use it should be. - + @@ -3023,7 +3023,7 @@ use it should be. - + @@ -3036,7 +3036,7 @@ use it should be. - + @@ -3047,7 +3047,7 @@ use it should be. - + @@ -3058,7 +3058,7 @@ use it should be. - + @@ -3077,7 +3077,7 @@ use it should be. glib:type-name="RegressTestBoxedB" glib:get-type="regress_test_boxed_b_get_type" c:symbol-prefix="test_boxed_b"> - + @@ -3085,7 +3085,7 @@ use it should be. - + @@ -3099,7 +3099,7 @@ use it should be. - + @@ -3115,7 +3115,7 @@ use it should be. glib:type-name="RegressTestBoxedC" glib:get-type="regress_test_boxed_c_get_type" c:symbol-prefix="test_boxed_c"> - + @@ -3123,7 +3123,7 @@ use it should be. - + @@ -3131,12 +3131,14 @@ use it should be. - + - + @@ -3150,7 +3152,7 @@ use it should be. - + @@ -3161,7 +3163,7 @@ use it should be. - + @@ -3172,7 +3174,7 @@ use it should be. - + @@ -3186,16 +3188,16 @@ use it should be. - + - + - + @@ -3220,7 +3222,7 @@ use it should be. - + @@ -3242,7 +3244,7 @@ use it should be. - + @@ -3250,25 +3252,25 @@ use it should be. the investment rate + line="1175">the investment rate how much money + line="1176">how much money Path to file + line="1177">Path to file - + @@ -3280,7 +3282,7 @@ use it should be. - + @@ -3288,7 +3290,7 @@ use it should be. a hash table; will be modified + line="1164">a hash table; will be modified @@ -3298,7 +3300,7 @@ use it should be. - + @@ -3306,20 +3308,20 @@ use it should be. GError instance; must be freed by the callback + line="1170">GError instance; must be freed by the callback - + - + @@ -3458,7 +3460,7 @@ use it should be. - + @@ -3501,9 +3503,9 @@ use it should be. glib:type-name="RegressTestFloating" glib:get-type="regress_test_floating_get_type" glib:type-struct="TestFloatingClass"> - + - + - + @@ -3536,9 +3538,9 @@ use it should be. glib:unref-func="regress_test_fundamental_object_unref" glib:set-value-func="regress_test_value_set_fundamental_object" glib:get-value-func="regress_test_value_get_fundamental_object"> - + - + @@ -3551,7 +3553,7 @@ use it should be. - + @@ -3563,7 +3565,7 @@ use it should be. - + - + @@ -3606,7 +3608,7 @@ use it should be. - + @@ -3621,7 +3623,7 @@ use it should be. - + @@ -3635,7 +3637,7 @@ use it should be. - + @@ -3658,10 +3660,10 @@ use it should be. Just like a #RegressTestFundamentalObject but without gvalue setter and getter - + - + @@ -3674,14 +3676,14 @@ use it should be. - + - + @@ -3703,7 +3705,7 @@ use it should be. - + @@ -3717,10 +3719,10 @@ use it should be. glib:get-type="regress_test_fundamental_sub_object_get_type" glib:type-struct="TestFundamentalSubObjectClass" glib:fundamental="1"> - + - + @@ -3742,7 +3744,7 @@ use it should be. - + @@ -3756,10 +3758,10 @@ use it should be. glib:get-type="regress_test_fundamental_sub_object_no_get_set_func_get_type" glib:type-struct="TestFundamentalSubObjectNoGetSetFuncClass" glib:fundamental="1"> - + - + @@ -3778,7 +3780,7 @@ use it should be. - + @@ -3902,10 +3904,10 @@ use it should be. glib:type-name="RegressTestInterface" glib:get-type="regress_test_interface_get_type" glib:type-struct="TestInterfaceIface"> - + - + @@ -3943,13 +3945,13 @@ use it should be. - + - + @@ -3961,15 +3963,15 @@ use it should be. glib:type-name="RegressTestObj" glib:get-type="regress_test_obj_get_type" glib:type-struct="TestObjClass"> - + - + - + @@ -3984,7 +3986,7 @@ use it should be. - + @@ -4011,7 +4013,7 @@ use it should be. - + @@ -4022,7 +4024,7 @@ use it should be. - + @@ -4042,7 +4044,7 @@ use it should be. - + @@ -4054,7 +4056,7 @@ use it should be. - + @@ -4069,7 +4071,7 @@ use it should be. - + @@ -4083,13 +4085,13 @@ use it should be. allow-none="1"> Another object + line="817">Another object - + @@ -4108,7 +4110,7 @@ use it should be. line="3221">This method is virtual. Notably its name differs from the virtual slot name, which makes it useful for testing bindings handle this case. - + @@ -4133,7 +4135,7 @@ case. line="3221">This method is virtual. Notably its name differs from the virtual slot name, which makes it useful for testing bindings handle this case. - + @@ -4154,7 +4156,7 @@ case. - + @@ -4166,7 +4168,7 @@ case. - + @@ -4181,7 +4183,7 @@ case. - + @@ -4196,7 +4198,7 @@ case. The signal handler must increment the inout parameter by 1. - + @@ -4211,7 +4213,7 @@ case. - + @@ -4223,7 +4225,7 @@ case. - + @@ -4238,7 +4240,7 @@ case. - + @@ -4250,7 +4252,7 @@ case. - + @@ -4261,7 +4263,7 @@ case. - + @@ -4277,7 +4279,7 @@ case. - + @@ -4289,7 +4291,7 @@ case. - + @@ -4301,7 +4303,7 @@ case. - + @@ -4320,7 +4322,7 @@ case. - + @@ -4332,7 +4334,7 @@ case. - + @@ -4347,7 +4349,7 @@ case. - + @@ -4376,7 +4378,7 @@ case. - + @@ -4398,7 +4400,7 @@ case. - + @@ -4417,7 +4419,7 @@ case. - + @@ -4436,7 +4438,7 @@ case. Check that the out value is skipped - + Check that the out value is skipped - + Check that a parameter is skipped - + Check that the return value is skipped - + filename="regress.c" line="3089">Check that the return value is skipped. Succeed if a is nonzero, otherwise raise an error. - + - + @@ -4801,7 +4803,7 @@ raise an error. This function throws an error if m is odd. - + @@ -4981,7 +4983,7 @@ raise an error. - + @@ -5238,13 +5240,13 @@ the introspection client langage. - + - + @@ -5266,7 +5268,7 @@ the introspection client langage. - + @@ -5280,7 +5282,7 @@ the introspection client langage. allow-none="1"> Another object + line="817">Another object @@ -5298,7 +5300,7 @@ the introspection client langage. - + @@ -5306,7 +5308,7 @@ the introspection client langage. - + @@ -5344,7 +5346,7 @@ the introspection client langage. - + @@ -5355,7 +5357,7 @@ the introspection client langage. - + @@ -5367,7 +5369,7 @@ the introspection client langage. - + @@ -5392,10 +5394,12 @@ the introspection client langage. - + ... + @@ -5409,7 +5413,7 @@ the introspection client langage. - + @@ -5420,7 +5424,7 @@ the introspection client langage. - + @@ -5435,7 +5439,7 @@ the introspection client langage. - + @@ -5447,7 +5451,7 @@ the introspection client langage. glib:type-name="RegressTestSimpleBoxedB" glib:get-type="regress_test_simple_boxed_b_get_type" c:symbol-prefix="test_simple_boxed_b"> - + @@ -5455,7 +5459,7 @@ the introspection client langage. - + @@ -5467,7 +5471,7 @@ the introspection client langage. - + @@ -5674,7 +5678,7 @@ the introspection client langage. - + @@ -5684,7 +5688,7 @@ the introspection client langage. - + @@ -5703,17 +5707,17 @@ the introspection client langage. glib:type-name="RegressTestSubObj" glib:get-type="regress_test_sub_obj_get_type" glib:type-struct="TestSubObjClass"> - + - + - + @@ -5724,7 +5728,7 @@ the introspection client langage. - + @@ -5754,7 +5758,7 @@ the introspection client langage. - + @@ -5766,16 +5770,16 @@ the introspection client langage. glib:type-name="RegressTestWi8021x" glib:get-type="regress_test_wi_802_1x_get_type" glib:type-struct="TestWi8021xClass"> - + - + - + @@ -5788,7 +5792,7 @@ the introspection client langage. - + @@ -5801,7 +5805,7 @@ the introspection client langage. - + @@ -5832,7 +5836,7 @@ the introspection client langage. - + @@ -5840,12 +5844,12 @@ the introspection client langage. - + - + @@ -6502,7 +6506,7 @@ exposed to language bindings. - + @@ -6520,7 +6524,7 @@ exposed to language bindings. - + @@ -6537,7 +6541,7 @@ exposed to language bindings. - + filename="regress.c" line="4701">This test case mirrors GnomeKeyringPasswordSchema from libgnome-keyring. - + @@ -6592,7 +6596,7 @@ libgnome-keyring. - + @@ -6605,7 +6609,7 @@ libgnome-keyring. - + @@ -6618,7 +6622,7 @@ libgnome-keyring. - + @@ -6661,7 +6665,7 @@ in particular, but it should be serialized in the gir nevertheless. - + @@ -6673,7 +6677,7 @@ in particular, but it should be serialized in the gir nevertheless. - + @@ -6848,7 +6852,7 @@ in particular, but it should be serialized in the gir nevertheless. - + @@ -7036,7 +7040,7 @@ in particular, but it should be serialized in the gir nevertheless. - + @@ -7060,7 +7064,7 @@ in particular, but it should be serialized in the gir nevertheless. Similar to: - gsf_property_settings_free() with structs but they contain pointers - g_byte_array_new_take() with guint8s - + @@ -7088,7 +7092,7 @@ Similar to: line="4853">Test flat array input with transfer none. Similar to g_main_context_check() or gtk_target_list_new(). - + @@ -7142,7 +7146,7 @@ Similar to g_main_context_check() or gtk_target_list_new(). line="4812">Test flat caller-allocated array output. Similar to g_main_context_query(). - + @@ -7176,7 +7180,7 @@ Similar to g_main_context_query(). line="4774">Test flat array output with transfer container. Similar to pango_layout_get_log_attrs(). - + @@ -7208,7 +7212,7 @@ Similar to pango_layout_get_log_attrs(). Test flat fixed-size array output with transfer full. - + @@ -7238,7 +7242,7 @@ Similar to: - mm_modem_peek_ports() with structs - gdk_query_visual_types() with enums - gdk_event_get_axes() with doubles - + @@ -7267,7 +7271,7 @@ Similar to: - + @@ -7318,7 +7322,7 @@ Similar to: - + @@ -7330,7 +7334,7 @@ Similar to: - + @@ -7396,7 +7400,7 @@ Similar to: - + @@ -7412,7 +7416,7 @@ Similar to: - + @@ -7438,7 +7442,7 @@ Similar to: filename="regress.c" line="4055">Notified - callback persists until a DestroyNotify delegate is invoked. - + @@ -7468,7 +7472,7 @@ is invoked. filename="regress.c" line="4082">Adds a scope notified callback with no user data. This can invoke an error condition in bindings which needs to be tested. - + @@ -7487,7 +7491,7 @@ condition in bindings which needs to be tested. - + @@ -7500,7 +7504,7 @@ condition in bindings which needs to be tested. - + @@ -7512,7 +7516,7 @@ condition in bindings which needs to be tested. line="4096">Invokes all callbacks installed by #test_callback_destroy_notify(), adding up their return values, and removes them, invoking the corresponding destroy notfications. - + filename="regress.c" line="4024">Call - callback parameter persists for the duration of the method call and can be released on return. - + @@ -7598,7 +7602,7 @@ call and can be released on return. - + @@ -7606,7 +7610,7 @@ call and can be released on return. - + @@ -7691,7 +7695,7 @@ call and can be released on return. - + @@ -8154,7 +8158,7 @@ element-type annotation. - + @@ -8272,7 +8276,7 @@ element-type annotation. - + @@ -8321,7 +8325,7 @@ It has multiple lines in the documentation. The sky is blue. You will give me your credit card number. - + @@ -8358,7 +8362,7 @@ rgb(20%, 30%, 0%)</literallayout></entry> </informaltable> What we're testing here is that the scanner ignores the @a nested inside XML. - + @@ -8373,7 +8377,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML. - + @@ -8389,7 +8393,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML. - + @@ -8401,14 +8405,14 @@ What we're testing here is that the scanner ignores the @a nested inside XML. - + - + @@ -8447,14 +8451,14 @@ What we're testing here is that the scanner ignores the @a nested inside XML. - + - + @@ -8486,7 +8490,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.Should not emit a warning: https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + @@ -8550,7 +8554,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + @@ -8609,7 +8613,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + @@ -8649,7 +8653,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 This function throws an error if m is odd. - + @@ -8685,7 +8689,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + @@ -8986,7 +8990,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + @@ -9018,7 +9022,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399 - + diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index 9a42bd71..962708b4 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -625,6 +625,15 @@ struct _RegressTestStructF typedef struct _RegressTestSimpleBoxedA RegressTestSimpleBoxedA; typedef struct _RegressTestSimpleBoxedB RegressTestSimpleBoxedB; +/** + * RegressTestSimpleBoxedA: (copy-func regress_test_simple_boxed_a_copy) + * @some_int: + * @some_int8: + * @some_double: + * @some_enum: + * + * ... + */ struct _RegressTestSimpleBoxedA { gint some_int; @@ -737,6 +746,11 @@ GType regress_test_boxed_c_get_type (void); _GI_TEST_EXTERN RegressTestBoxedC *regress_test_boxed_c_new (void); +/** + * RegressTestBoxedD: (copy-func regress_test_boxed_d_copy) + * (free-func regress_test_boxed_d_free) + * + */ typedef struct _RegressTestBoxedD RegressTestBoxedD; -- cgit v1.2.1