diff options
-rw-r--r-- | test cases/frameworks/7 gnome/gir/meson-sample.c | 2 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/meson.build | 15 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/private-function.c | 47 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/private-function.h | 20 | ||||
-rw-r--r-- | test cases/frameworks/7 gnome/gir/prog.c | 6 |
5 files changed, 87 insertions, 3 deletions
diff --git a/test cases/frameworks/7 gnome/gir/meson-sample.c b/test cases/frameworks/7 gnome/gir/meson-sample.c index dbf3625..7f34a3f 100644 --- a/test cases/frameworks/7 gnome/gir/meson-sample.c +++ b/test cases/frameworks/7 gnome/gir/meson-sample.c @@ -112,8 +112,6 @@ meson_sample_init (MesonSample *self) * @self: a #MesonSample. * * Prints the message. - * - * Returns: Nothing. */ void meson_sample_print_message (MesonSample *self) diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build index a513062..ce98aa7 100644 --- a/test cases/frameworks/7 gnome/gir/meson.build +++ b/test cases/frameworks/7 gnome/gir/meson.build @@ -7,9 +7,11 @@ girlib = shared_library( install : true ) +privsources = ['private-function.c', 'private-function.h'] + girexe = executable( 'girprog', - sources : 'prog.c', + sources : ['prog.c'] + privsources, dependencies : [glib, gobj, gir], link_with : girlib ) @@ -28,6 +30,17 @@ gnome.generate_gir( install : true ) +gnome.generate_gir( + girexe, + sources : privsources, + nsversion : '1.0', + namespace : 'Private', + symbol_prefix : 'private_', + identifier_preifx : 'Private', + includes : 'GObject-2.0', + install : true +) + test('gobject introspection/c', girexe) test('gobject introspection/py', find_program('prog.py'), env : ['GI_TYPELIB_PATH=' + girlib.outdir(), diff --git a/test cases/frameworks/7 gnome/gir/private-function.c b/test cases/frameworks/7 gnome/gir/private-function.c new file mode 100644 index 0000000..4b34ab4 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/private-function.c @@ -0,0 +1,47 @@ +#include "private-function.h" + +struct _PrivateFunction +{ + GObject parent_instance; +}; + +G_DEFINE_TYPE (PrivateFunction, private_function, G_TYPE_OBJECT) + +/** + * private_function_new: + * + * Allocates a new #PrivateFunction. + * + * Returns: (transfer full): a #PrivateFunction. + */ +PrivateFunction * +private_function_new (void) +{ + return g_object_new (PRIVATE_TYPE_FUNCTION, NULL); +} + +static void +private_function_class_init (PrivateFunctionClass *klass) +{ +} + +static void +private_function_init (PrivateFunction *self) +{ +} + +/** + * private_function_return_0: + * @self: a #PrivateFunction. + * + * Prints the message. + * + * Returns: 0. + */ +int +private_function_return_0 (PrivateFunction *self) +{ + g_assert (PRIVATE_IS_FUNCTION (self)); + + return 0; +} diff --git a/test cases/frameworks/7 gnome/gir/private-function.h b/test cases/frameworks/7 gnome/gir/private-function.h new file mode 100644 index 0000000..a3c73ff --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/private-function.h @@ -0,0 +1,20 @@ +#ifndef PRIVATE_FUNCTION_H +#define PRIVATE_FUNCTION_H + +#if !defined (MESON_TEST) +#error "MESON_TEST not defined." +#endif + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define PRIVATE_TYPE_FUNCTION (private_function_get_type()) +G_DECLARE_FINAL_TYPE (PrivateFunction, private_function, PRIVATE, FUNCTION, GObject) + +PrivateFunction *private_function_new (void); +int private_function_return_0 (PrivateFunction *self); + +G_END_DECLS + +#endif /* PRIVATE_FUNCTION_H */ diff --git a/test cases/frameworks/7 gnome/gir/prog.c b/test cases/frameworks/7 gnome/gir/prog.c index c855a6b..6ca3411 100644 --- a/test cases/frameworks/7 gnome/gir/prog.c +++ b/test cases/frameworks/7 gnome/gir/prog.c @@ -1,6 +1,7 @@ #include <girepository.h> #include "meson-sample.h" +#include "private-function.h" gint main (gint argc, @@ -11,6 +12,8 @@ main (gint argc, GOptionContext * ctx = g_option_context_new (NULL); g_option_context_add_group (ctx, g_irepository_get_option_group ()); + g_type_ensure (PRIVATE_TYPE_FUNCTION); + if (!g_option_context_parse (ctx, &argc, &argv, &error)) { g_print ("sample: %s\n", error->message); g_option_context_free (ctx); @@ -24,6 +27,9 @@ main (gint argc, MesonSample * i = meson_sample_new ("Hello, meson/c!"); meson_sample_print_message (i); + PrivateFunction * f = private_function_new (); + g_assert (private_function_return_0 (f) == 0); + g_object_unref (i); g_option_context_free (ctx); |