37 |
# AT_DATA_LINENO(FILENAME, |
# AT_DATA_LINENO(FILENAME, |
38 |
# UNSET-LINENO = true | false, COUNTER, COUNTER-RE) |
# UNSET-LINENO = true | false, COUNTER, COUNTER-RE) |
39 |
# ---------------------------------------------------------------- |
# ---------------------------------------------------------------- |
40 |
# Produce FILENAME which uses the COUNTER LINENO or _oline_, which |
# Produce the FILENAME M4sh script which uses the COUNTER LINENO or |
41 |
# we can recognized via COUNTER-RE. Unset LINENO is UNSET-LINENO. |
# _oline_, which we can recognized via COUNTER-RE. Unset LINENO is |
42 |
|
# UNSET-LINENO. |
43 |
# |
# |
44 |
# Use COUNTER, COUNTER-RE = [$@&t@LINENO], [LINENO] |
# Use COUNTER, COUNTER-RE = [__LINENO__], [LINENO] |
45 |
# or = [__@&t@oline__], [_oline__] |
# or = [__OLINE__], [_oline__] |
46 |
# to make sure we are not replace in the test suite itself and to avoid |
# |
47 |
# seeing the COUNTER-RE being replaced. |
# instead of the obvious $LINENO and __oline__, because they would |
48 |
|
# be replaced in the test suite itself, even before creating these |
49 |
|
# scripts. For the same reason, grep for LINENO and _oline__ (sic). |
50 |
# |
# |
51 |
# UNSET-LINENO is a shell condition to make sure the scripts have the |
# UNSET-LINENO is a shell condition to make sure the scripts have the |
52 |
# same number of lines in the output, so that their outputs be identical. |
# same number of lines in the output, so that their outputs be identical. |
53 |
m4_define([AT_DATA_LINENO], |
m4_define([AT_DATA_LINENO], |
54 |
[AT_DATA([$1], |
[AT_DATA([$1.tas], |
55 |
[[AS@&t@_INIT |
[[AS@&t@_INIT |
56 |
if $2; then |
if $2; then |
57 |
AS@&t@_UNSET([LINENO]) |
AS@&t@_UNSET([LINENO]) |
62 |
AS@&t@_ERROR([cannot find original script]) |
AS@&t@_ERROR([cannot find original script]) |
63 |
exit 0 |
exit 0 |
64 |
]]) |
]]) |
65 |
|
# If occurrences of $LINENO or __oline__ were wanted, create them. |
66 |
|
sed 's/__LINENO__/$''LINENO/g;s/__OLINE__/__''oline__/g' $1.tas >$1.as |
67 |
|
AT_CHECK([autom4te -l m4sh $1.as -o $1]) |
68 |
])# AT_DATA_LINENO |
])# AT_DATA_LINENO |
69 |
|
|
70 |
# `_oline_', once processed and ran, produces our reference. |
# `_oline_', once processed and ran, produces our reference. |
71 |
# We check that we find ourselves by looking at a string which is |
# We check that we find ourselves by looking at a string which is |
72 |
# available only in the original script: `_oline_'. |
# available only in the original script: `_oline_'. |
73 |
AT_DATA_LINENO([reference.as], [false], [__@&t@oline__], [_oline__]) |
AT_DATA_LINENO([reference], [false], [__OLINE__], [_oline__]) |
|
AT_CHECK([autom4te -l m4sh reference.as -o reference]) |
|
74 |
AT_CHECK([./reference], 0, [stdout]) |
AT_CHECK([./reference], 0, [stdout]) |
75 |
|
|
76 |
# The reference: |
# The reference: |
80 |
# Be sure to be out of the PATH. |
# Be sure to be out of the PATH. |
81 |
AT_CHECK([mkdir test || exit 77]) |
AT_CHECK([mkdir test || exit 77]) |
82 |
|
|
83 |
AT_DATA_LINENO([test/test-1.as], [false], [$@&t@LINENO], [LINENO]) |
AT_DATA_LINENO([test/test-1], [false], [__LINENO__], [LINENO]) |
|
AT_CHECK([autom4te -l m4sh test/test-1.as -o test/test-1]) |
|
84 |
AT_CHECK([./test/test-1], 0, [expout]) |
AT_CHECK([./test/test-1], 0, [expout]) |
85 |
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-1)], |
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-1)], |
86 |
0, [expout]) |
0, [expout]) |
87 |
AT_CHECK([sh ./test/test-1], 0, [expout]) |
AT_CHECK([sh ./test/test-1], 0, [expout]) |
88 |
|
|
89 |
# Now using a disabled LINENO, with different call conventions. |
# Now using a disabled LINENO, with different call conventions. |
90 |
AT_DATA_LINENO([test/test-2.as], [true], [$@&t@LINENO], [LINENO]) |
AT_DATA_LINENO([test/test-2], [true], [__LINENO__], [LINENO]) |
|
AT_CHECK([autom4te -l m4sh test/test-2.as -o test/test-2]) |
|
91 |
AT_CHECK([./test/test-2], 0, [expout]) |
AT_CHECK([./test/test-2], 0, [expout]) |
92 |
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-2)], |
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-2)], |
93 |
0, [expout]) |
0, [expout]) |