X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/ee1d01180583f7a4940bce0d1bda85c8379b6b4b..HEAD:/tests/interface.at diff --git a/tests/interface.at b/tests/interface.at index e750bc4..4cc41d9 100644 --- a/tests/interface.at +++ b/tests/interface.at @@ -1,4 +1,4 @@ -dnl Copyright © 2020 Nick Bowler +dnl Copyright © 2020, 2022-2023 Nick Bowler dnl License GPLv2+: GNU General Public License version 2 or any later version. dnl This is free software: you are free to change and redistribute it. dnl There is NO WARRANTY, to the extent permitted by law. @@ -25,7 +25,10 @@ m4_define([TEST_FOOABLE_IMPL_DYN], TEST_TYPE_MODULE([$1])]) m4_define([TEST_FOOABLE_IMPL_], -[AT_DATA([$2.gob], [[%{ +[AT_DATA([$2.gob], [[%ctop{ +#include +%} +%{ #include #include #include "test-fooable.h" @@ -58,7 +61,8 @@ TEST_FOOABLE_IFACE() TEST_FOOABLE_IMPL([Test:A], [G:Object], [return 42;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -67,6 +71,7 @@ int main(void) { int rc; + g_type_init(); rc = test_foo(g_object_new(TEST_TYPE_A, NULL)); printf("%d\n", rc); if (rc < 0) @@ -75,9 +80,7 @@ int main(void) } ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-fooable.o main.o]) +TEST_LINK_GOBJECT([main], [test-a.o test-fooable.o main.o]) AT_CHECK([./main], [0], [42 ]) @@ -91,7 +94,8 @@ TEST_FOOABLE_IFACE() TEST_FOOABLE_IMPL_DYN([Test:A], [G:Object], [return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -101,6 +105,7 @@ int main(void) { int rc; + g_type_init(); g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL)); rc = test_foo(g_object_new(TEST_TYPE_A, NULL)); @@ -111,9 +116,7 @@ int main(void) } ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-a-mod.o test-fooable.o main.o]) +TEST_LINK_GOBJECT([main], [test-a.o test-a-mod.o test-fooable.o main.o]) AT_CHECK([./main], [0], [54 ]) @@ -131,7 +134,8 @@ TEST_FOOABLE_IMPL([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -141,6 +145,7 @@ int main(void) { int rc; + g_type_init(); rc = test_foo(g_object_new(TEST_TYPE_A, NULL)); printf("%d\n", rc); if (rc < 0) @@ -155,9 +160,7 @@ int main(void) } ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-b.o test-fooable.o main.o]) +TEST_LINK_GOBJECT([main], [test-a.o test-b.o test-fooable.o main.o]) AT_CHECK([./main], [0], [Test:A foo called 42 Test:B foo called @@ -178,7 +181,8 @@ TEST_FOOABLE_IMPL_DYN([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -189,6 +193,7 @@ int main(void) { int rc; + g_type_init(); g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL)); rc = test_foo(g_object_new(TEST_TYPE_A, NULL)); @@ -205,10 +210,8 @@ int main(void) } ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-b.o test-b-mod.o test-fooable.o main.o]) - +TEST_LINK_GOBJECT([main], + [test-a.o test-b.o test-b-mod.o test-fooable.o main.o]) AT_CHECK([./main], [0], [Test:A foo called 42 Test:B foo called @@ -229,7 +232,8 @@ TEST_FOOABLE_IMPL_DYN([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -241,6 +245,7 @@ int main(void) { int rc; + g_type_init(); g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL)); g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL)); @@ -258,10 +263,8 @@ int main(void) } ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-a-mod.o test-b.o test-b-mod.o test-fooable.o main.o]) - +TEST_LINK_GOBJECT([main], + [test-a.o test-a-mod.o test-b.o test-b-mod.o test-fooable.o main.o]) AT_CHECK([./main], [0], [Test:A foo called 42 Test:B foo called @@ -282,7 +285,8 @@ TEST_FOOABLE_IMPL([Test:C], [Test:B], [puts("Test:C foo called"); return PARENT_HANDLER(go);]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -293,6 +297,7 @@ int main(void) { int rc; + g_type_init(); rc = test_foo(g_object_new(TEST_TYPE_C, NULL)); printf("%d\n", rc); if (rc < 0) @@ -303,9 +308,7 @@ int main(void) ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-b.o test-c.o test-fooable.o main.o]) +TEST_LINK_GOBJECT([main], [test-a.o test-b.o test-c.o test-fooable.o main.o]) AT_CHECK([./main], [0], [Test:C foo called Test:B foo called Test:A foo called @@ -326,7 +329,8 @@ TEST_FOOABLE_IMPL_DYN([Test:C], [Test:B], [puts("Test:C foo called"); return PARENT_HANDLER(go);]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -340,6 +344,7 @@ int main(void) { int rc; + g_type_init(); g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL)); g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL)); g_type_module_use(g_object_new(TEST_TYPE_C_MOD, NULL)); @@ -354,10 +359,9 @@ int main(void) ]]) TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore]) - -AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \ - test-a.o test-a-mod.o test-b.o test-b-mod.o test-c.o test-c-mod.o \ - test-fooable.o main.o]) +TEST_LINK_GOBJECT([main], m4_join([ ], + [test-a.o test-a-mod.o test-b.o test-b-mod.o test-c.o test-c-mod.o], + [test-fooable.o main.o])) AT_CHECK([./main], [0], [Test:C foo called Test:B foo called Test:A foo called