]> git.draconx.ca Git - dxcommon.git/blobdiff - tests/scripts.at
Partially fix "make distcheck".
[dxcommon.git] / tests / scripts.at
index c03a83f2d2baa080b37e48fb1472cad0abdd0ef2..c38faba07caf02cc03fa5836ec85d39e92ef2297 100644 (file)
@@ -37,7 +37,7 @@ do stuff with ARG
 --flagval
 ]])
 
-AT_CHECK([$AWK -f "$builddir/scripts/gen-options.awk" <options.def >options.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-options.awk" <options.def >options.h])
 
 AT_DATA([context.h],
 [[struct option { const char *name; int has_arg; int *flag; int val; };
@@ -268,7 +268,7 @@ int main(void)
 AT_DATA([single.dat],
 [[--single-option
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-options.awk" <single.dat >options.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-options.awk" <single.dat >options.h])
 AT_CHECK([$CC -o single$EXEEXT test.c && ./single$EXEEXT], [0],
 [[0
 --single-option, 0, 0
@@ -280,7 +280,7 @@ AT_DATA([16bit.dat],
 -c, --the-third-option[=ARG]
 -d, --the-fourth-option
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-options.awk" <16bit.dat >options.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-options.awk" <16bit.dat >options.h])
 AT_CHECK([$CC -o 16bit$EXEEXT test.c && ./16bit$EXEEXT], [0],
 [[2
 --the-first-option, 0, 'a'
@@ -317,7 +317,7 @@ newline\
 # with a comment
 ]])
 
-AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test.def >test.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test.def >test.h])
 
 sed -n 's/^[[&]]\([[^ ]]*\).*/\1/p' test.def >identifiers
 
@@ -379,13 +379,13 @@ AT_KEYWORDS([gen-strtab awk script scripts])
 AT_DATA([test0.def],
 [[&hello hello
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test0.def >test0.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test0.def >test0.h])
 
 AT_DATA([test1.def],
 [[@nozero
 &hello hello
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test1.def >test1.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test1.def >test1.h])
 
 AT_DATA([test.c],
 [[#include <stdio.h>
@@ -401,6 +401,37 @@ AT_CHECK([$CC -DHEADER='"test1.h"' -o test1$EXEEXT test.c && ./test1$EXEEXT],
 
 AT_CLEANUP
 
+AT_SETUP([gen-strtab.awk @macro option])
+AT_KEYWORDS([gen-strtab awk script scripts])
+
+AT_DATA([test0.def],
+[[@macro
+&foo foobar
+&bar bar
+&baz baz
+]])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test0.def >test0.h])
+
+AT_DATA([test0.c],
+[[#include <stdio.h>
+extern const char strtab[];
+#include "test0.h"
+
+int main(void)
+{
+  static const char mystrtab[] = STRTAB_INITIALIZER;
+  printf("%s\n%s\n%s\n", mystrtab+foo, mystrtab+bar, mystrtab+baz);
+  return 0;
+}
+]])
+AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0],
+[[foobar
+bar
+baz
+]])
+
+AT_CLEANUP
+
 AT_SETUP([gen-strtab.awk l10n options])
 AT_KEYWORDS([gen-strtab awk script scripts])
 
@@ -414,7 +445,7 @@ AT_DATA([test0.def],
 &b world
 &c goodbye
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test0.def >test0.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test0.def >test0.h])
 AT_CHECK([sed -n -f l10n.sed test0.h | LC_ALL=C sort], [0],
 [["goodbye"
 "hello world"
@@ -426,7 +457,7 @@ AT_DATA([test1.def],
 &&b world
 &&c goodbye
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test1.def >test1.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-strtab.awk" <test1.def >test1.h])
 AT_CHECK([sed -n -f l10n.sed test1.h], [0],
 [["hello world"
 ]])
@@ -481,7 +512,7 @@ ROOT1
 # comment
 ]])
 
-AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <tree.def >tree.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-tree.awk" <tree.def >tree.h])
 
 AT_DATA([test0.c],
 [[#include "tree.h"
@@ -539,7 +570,7 @@ ROOT
   e 1
   f 2
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <tree.def >tree.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-tree.awk" <tree.def >tree.h])
 
 AT_DATA([test0.c],
 [[float tree_strtab = 0;
@@ -582,7 +613,7 @@ AT_DATA([flat.def],
  c 3
 @nostrtab
 ]])
-AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <flat.def >flat.h])
+AT_CHECK([$AWK -f "$srcdir/scripts/gen-tree.awk" <flat.def >flat.h])
 
 sed -e 's/tree\.h/flat.h/' -e 's/ROOT/FLAT/' test0.c >test1.c
 AT_CHECK([$CC -o test1$EXEEXT test1.c && ./test1$EXEEXT], [0],
@@ -597,7 +628,7 @@ AT_CLEANUP
 AT_SETUP([join.awk])
 AT_KEYWORDS([join awk script scripts])
 
-JOIN="$AWK -f $builddir/scripts/join.awk --"
+JOIN="$AWK -f $srcdir/scripts/join.awk --"
 
 AT_DATA([a],
 [[1 a