diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-04-03 23:13:09 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-05-12 19:46:35 +0200 |
commit | 89908f752a9467f0659c2d93aaf7ee1b99716119 (patch) | |
tree | e8272cf6691e6dd9c87f3f7fffb1adc2c09a264e /tests | |
parent | b8247d8291f3386363933710d09f698e5e8e98bd (diff) | |
download | gobject-introspection-89908f752a9467f0659c2d93aaf7ee1b99716119.tar.gz |
GScannerParser: recognize character constants
Some enumerations (like GVariantClass) use characters instead of
plain integers, so we need to recognize them.
https://bugzilla.gnome.org/show_bug.cgi?id=646635
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 9 | ||||
-rw-r--r-- | tests/scanner/regress.c | 1 | ||||
-rw-r--r-- | tests/scanner/regress.h | 11 |
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 52c5f8d4..90c93202 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -184,6 +184,15 @@ use it should be.</doc> value="-1" c:identifier="REGRESS_TEST_VALUE3" glib:nick="value3"/> + <member name="value4" + value="48" + c:identifier="REGRESS_TEST_VALUE4" + glib:nick="value4"/> + </enumeration> + <enumeration name="TestEnumNoGEnum" c:type="RegressTestEnumNoGEnum"> + <member name="evalue1" value="0" c:identifier="REGRESS_TEST_EVALUE1"/> + <member name="evalue2" value="42" c:identifier="REGRESS_TEST_EVALUE2"/> + <member name="evalue3" value="48" c:identifier="REGRESS_TEST_EVALUE3"/> </enumeration> <enumeration name="TestEnumUnsigned" glib:type-name="RegressTestEnumUnsigned" diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index a2fb90ff..27031b1e 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1234,6 +1234,7 @@ regress_test_enum_get_type (void) { REGRESS_TEST_VALUE1, "REGRESS_TEST_VALUE1", "value1" }, { REGRESS_TEST_VALUE2, "REGRESS_TEST_VALUE2", "value2" }, { REGRESS_TEST_VALUE3, "REGRESS_TEST_VALUE3", "value3" }, + { REGRESS_TEST_VALUE4, "REGRESS_TEST_VALUE4", "value4" }, { 0, NULL, NULL } }; etype = g_enum_register_static (g_intern_static_string ("RegressTestEnum"), values); diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index fd41a290..aafc25c6 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -137,7 +137,8 @@ typedef enum { REGRESS_TEST_VALUE1, REGRESS_TEST_VALUE2, - REGRESS_TEST_VALUE3 = -1 + REGRESS_TEST_VALUE3 = -1, + REGRESS_TEST_VALUE4 = '0' } RegressTestEnum; typedef enum @@ -160,6 +161,14 @@ GType regress_test_enum_unsigned_get_type (void) G_GNUC_CONST; GType regress_test_flags_get_type (void) G_GNUC_CONST; #define REGRESS_TEST_TYPE_FLAGS (regress_test_flags_get_type ()) +/* this is not registered with GType */ +typedef enum +{ + REGRESS_TEST_EVALUE1, + REGRESS_TEST_EVALUE2 = 42, + REGRESS_TEST_EVALUE3 = '0' +} RegressTestEnumNoGEnum; + const gchar * regress_test_enum_param(RegressTestEnum e); const gchar * regress_test_unsigned_enum_param(RegressTestEnumUnsigned e); |