X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/0f7ec1e61526025bc5441210f6f2f9e6995c8bac..185449d25b2f9c93d2928e4745e8aa64d7d9ab9c:/tests/general.at diff --git a/tests/general.at b/tests/general.at new file mode 100644 index 0000000..355f09e --- /dev/null +++ b/tests/general.at @@ -0,0 +1,68 @@ +dnl Copyright © 2019 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. + +AT_SETUP([test.gob compilation]) + +AT_CHECK([gob2 "$abs_top_srcdir/t/test.gob"]) +AT_CHECK([$HAVE_GTK2 || exit 77]) +TEST_COMPILE_GOBJECT([$GTK_CFLAGS test-object.c], [0], [], [ignore]) + +AT_CLEANUP + +AT_SETUP([test.gob C++ compilation]) + +AT_CHECK([gob2 --for-cpp "$abs_top_srcdir/t/test.gob"]) +AT_CHECK([$HAVE_GTK2 || exit 77]) +TEST_COMPILEXX_GOBJECT([$GTK_CFLAGS test-object.cc], [0], [], [ignore]) + +AT_CLEANUP + +AT_SETUP([str.gob]) + +AT_DATA([main.c], +[[#include "str.h" + +int main(void) +{ + g_type_init (); + + int the_answer = 42; + char *stupid_pointer = "ug"; + + /* This works fine. */ + Str *test_good = (Str *) (str_new ("%d", the_answer)); + test_good = test_good; + + /* This gets a warning thanks to our function attribute. */ + Str *test_bad = (Str *) (str_new ("%d", stupid_pointer)); + test_bad = test_bad; + + return 0; +} +]]) + +str_gob=$abs_top_srcdir/t/str.gob +AT_CHECK([gob2 "$str_gob"]) +TEST_COMPILE_GOBJECT([str.c], [0], [], [stderr]) +mv stderr str_stderr + +# Check for correct diagnostic messages on the target lines... +AT_CHECK([awk '/want a string/ { print NR }' "$str_gob" >str_lines]) +total=0 +exec 3