]> git.draconx.ca Git - dxcommon.git/blobdiff - tests/scripts.at
Add a script to embed config.h into installed headers.
[dxcommon.git] / tests / scripts.at
index a510f2529e9a2a718e86279d447240f8850b5bb7..3a91bd0689887cb3ba98ba8a4e8920b45fc24024 100644 (file)
@@ -6,6 +6,38 @@ dnl There is NO WARRANTY, to the extent permitted by law.
 
 AT_BANNER([Script tests])
 
+AT_SETUP([bake-config.awk])
+AT_KEYWORDS([bake-config awk script scripts])
+
+AT_DATA([cfg.h],
+[[#define hello world
+/* #undef HAVE_STUFF */
+#define HAVE_OTHER_STUFF 1
+/* #undef HAVE_CRAZY_STUFF */
+]])
+
+AT_DATA([lib.h],
+[[#if HAVE_STUFF
+#  define foo hello__
+#elif HAVE_CRAZY_STUFF
+#  define foo hello
+#elif HAVE_OTHER_STUFF
+#  define foo __hello
+#endif
+]])
+
+AT_CHECK([$AWK -f "$srcdir/scripts/bake-config.awk" cfg.h lib.h], [0],
+[[#if 0 /* HAVE_STUFF */
+#  define foo hello__
+#elif 0 /* HAVE_CRAZY_STUFF */
+#  define foo world /* hello */
+#elif 1 /* HAVE_OTHER_STUFF */
+#  define foo __hello
+#endif
+]])
+
+AT_CLEANUP
+
 m4_define([TEST_GEN_OPTIONS],
 [AT_KEYWORDS([gen-options awk script scripts])dnl
 AT_DATA([m4_default([$2], [options.def])], [$1])