23 |
|
|
24 |
AT_SETUP([capitalize]) |
AT_SETUP([capitalize]) |
25 |
|
|
26 |
AT_CHECK_M4([examples/capitalize.m4], 0, |
AT_DATA([[capitalize.m4]], |
27 |
|
[[dnl |
28 |
|
dnl convert to upper- resp. lowercase |
29 |
|
define(`upcase', `translit(`$*', `a-z', `A-Z')') |
30 |
|
define(`downcase', `translit(`$*', `A-Z', `a-z')') |
31 |
|
upcase(`Convert to upper case') |
32 |
|
downcase(`Convert To LOWER Case') |
33 |
|
dnl |
34 |
|
dnl capitalize a single word |
35 |
|
define(`capitalize1', `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')') |
36 |
|
define(`capitalize', `patsubst(`$1', `\w+', ``'capitalize1(`\&')')') |
37 |
|
capitalize(`This sentence should be capitalized') |
38 |
|
]]) |
39 |
|
|
40 |
|
AT_CHECK_M4([capitalize.m4], 0, |
41 |
[[ |
[[ |
42 |
|
|
43 |
CONVERT TO UPPER CASE |
CONVERT TO UPPER CASE |
55 |
## changeword ## |
## changeword ## |
56 |
## ---------- ## |
## ---------- ## |
57 |
|
|
58 |
AT_SETUP([changeword]) |
AT_SETUP([[changeword]]) |
59 |
|
|
60 |
# cannot perform test without --enable-changeword |
# cannot perform test without --enable-changeword |
61 |
AT_CHECK([test "$ENABLE_CHANGEWORD" = yes || exit 77]) |
AT_CHECK([test "$ENABLE_CHANGEWORD" = yes || exit 77]) |
85 |
|
|
86 |
AT_SETUP([comments]) |
AT_SETUP([comments]) |
87 |
|
|
88 |
AT_CHECK_M4([examples/comments.m4], 0, |
AT_DATA([[comments.m4]], |
89 |
|
[[# An ordinary comment |
90 |
|
define(`foo', # A comment in a macro |
91 |
|
`Macro `foo' expansion') |
92 |
|
foo |
93 |
|
define(`comment', `*** Macro `comment' expansion ***') |
94 |
|
changecom(`@', `@') |
95 |
|
foo |
96 |
|
]]) |
97 |
|
|
98 |
|
AT_CHECK_M4([comments.m4], 0, |
99 |
[[# An ordinary comment |
[[# An ordinary comment |
100 |
|
|
101 |
# A comment in a macro |
# A comment in a macro |
116 |
|
|
117 |
AT_SETUP([ddivert]) |
AT_SETUP([ddivert]) |
118 |
|
|
119 |
AT_CHECK_M4([examples/ddivert.m4], 0, |
AT_DATA([[ddivert.m4]], |
120 |
|
[[divert(1)Text diverted a first time. |
121 |
|
divert(0)undivert(1)dnl |
122 |
|
divert(1)Text diverted a second time. |
123 |
|
divert(0)undivert(1)dnl |
124 |
|
]]) |
125 |
|
|
126 |
|
AT_CHECK_M4([ddivert.m4], 0, |
127 |
[[Text diverted a first time. |
[[Text diverted a first time. |
128 |
Text diverted a second time. |
Text diverted a second time. |
129 |
]]) |
]]) |
138 |
|
|
139 |
AT_SETUP([debug]) |
AT_SETUP([debug]) |
140 |
|
|
141 |
|
AT_DATA([[debug.m4]], |
142 |
|
[[define(`countdown', `$1 ifelse(eval($1 > 0), 1, `countdown(decr($1))', `Liftoff')') |
143 |
|
debugmode(`aeqc') |
144 |
|
traceon(`countdown') |
145 |
|
countdown(2) |
146 |
|
]]) |
147 |
|
|
148 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
149 |
[[ |
[[ |
150 |
|
|
164 |
m4trace: -1- countdown(...) -> `0 ifelse(eval(0 > 0), 1, `countdown(decr(0))', `Liftoff')' |
m4trace: -1- countdown(...) -> `0 ifelse(eval(0 > 0), 1, `countdown(decr(0))', `Liftoff')' |
165 |
]]) |
]]) |
166 |
|
|
167 |
AT_CHECK_M4([examples/debug.m4], 0, expout, experr) |
AT_CHECK_M4([debug.m4], 0, expout, experr) |
168 |
|
|
169 |
AT_CLEANUP |
AT_CLEANUP |
170 |
|
|
202 |
|
|
203 |
AT_SETUP([esyscmd]) |
AT_SETUP([esyscmd]) |
204 |
|
|
205 |
AT_CHECK_M4([examples/esyscmd.m4], 0, |
AT_DATA([[esyscmd.m4]], |
206 |
|
[[# Cannot use real hostname program because test would fail |
207 |
|
define(`hostname', esyscmd(`echo www.gnu.org'))dnl |
208 |
|
`hostname = >>'hostname`<<' |
209 |
|
define(`hostname', |
210 |
|
pushdef(`_tmp', `$1')_tmp(translit(esyscmd(`echo www.gnu.org'), `.', `,'))`'popdef(`_tmp'))dnl |
211 |
|
`hostname = >>'hostname`<<' |
212 |
|
]]) |
213 |
|
|
214 |
|
AT_CHECK_M4([esyscmd.m4], 0, |
215 |
[[# Cannot use real hostname program because test would fail |
[[# Cannot use real hostname program because test would fail |
216 |
hostname = >>www.gnu.org |
hostname = >>www.gnu.org |
217 |
<< |
<< |
228 |
|
|
229 |
AT_SETUP([exp]) |
AT_SETUP([exp]) |
230 |
|
|
231 |
AT_CHECK_M4([examples/exp.m4], 0, |
AT_DATA([[exp.m4]], |
232 |
|
[[define(`countdown', `$1 |
233 |
|
ifelse(eval($1 > 0), 1, `countdown(decr($1))', `Done')')dnl |
234 |
|
countdown(7) |
235 |
|
]]) |
236 |
|
|
237 |
|
AT_CHECK_M4([exp.m4], 0, |
238 |
[[7 |
[[7 |
239 |
6 |
6 |
240 |
5 |
5 |
256 |
|
|
257 |
AT_SETUP([foreach]) |
AT_SETUP([foreach]) |
258 |
|
|
259 |
AT_CHECK_M4([examples/foreach.m4], 0, |
AT_DATA([[foreach.m4]], |
260 |
|
[[divert(-1) |
261 |
|
# foreach(x, (item_1, item_2, ..., item_n), stmt) |
262 |
|
define(`foreach', `pushdef(`$1', `')_foreach($@)popdef(`$1')') |
263 |
|
define(`_arg1', ``$1'') |
264 |
|
define(`_foreach', |
265 |
|
`ifelse($2, `()', , |
266 |
|
`define(`$1', `_arg1$2')$3`'_foreach(`$1', `(shift$2)', `$3')')') |
267 |
|
|
268 |
|
# traceon(`define', `foreach', `_foreach', `ifelse') |
269 |
|
|
270 |
|
define(a, 1) |
271 |
|
define(b, 2) |
272 |
|
define(c, 3) |
273 |
|
divert |
274 |
|
foreach(`x', `(foo, bar, foobar)', `Word was: x |
275 |
|
') |
276 |
|
|
277 |
|
# Quote torture from Akim Demaille <akim@epita.fr> |
278 |
|
foreach(`x', `(`a', `(b', `c)')', `Word was: x |
279 |
|
') |
280 |
|
|
281 |
|
# Something more complex, from Pierre Gaumond <gaumondp@ere.umontreal.ca>. |
282 |
|
define(`case', ` $1) |
283 |
|
$2=" -$1";; |
284 |
|
')dnl |
285 |
|
define(`_cat', `$1$2')dnl |
286 |
|
`case' "$1" in |
287 |
|
foreach(`x', ((a, vara), (b, varb), (c, varc)), `_cat(`case', x)')dnl |
288 |
|
esac |
289 |
|
]]) |
290 |
|
|
291 |
|
AT_CHECK_M4([foreach.m4], 0, |
292 |
[[ |
[[ |
293 |
Word was: foo |
Word was: foo |
294 |
Word was: bar |
Word was: bar |
322 |
|
|
323 |
AT_SETUP([forloop]) |
AT_SETUP([forloop]) |
324 |
|
|
325 |
AT_CHECK_M4([examples/forloop.m4], 0, |
AT_DATA([[forloop.m4]], |
326 |
|
[[divert(-1) |
327 |
|
# forloop(i, from, to, stmt) |
328 |
|
|
329 |
|
define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') |
330 |
|
define(`_forloop', |
331 |
|
`$4`'ifelse($1, `$3', , |
332 |
|
`define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') |
333 |
|
divert |
334 |
|
forloop(`x', 1, 10, `2**x = eval(2**x) |
335 |
|
') |
336 |
|
]]) |
337 |
|
|
338 |
|
AT_CHECK_M4([forloop.m4], 0, |
339 |
[[ |
[[ |
340 |
2**1 = 2 |
2**1 = 2 |
341 |
2**2 = 4 |
2**2 = 4 |
360 |
|
|
361 |
AT_SETUP([fstab]) |
AT_SETUP([fstab]) |
362 |
|
|
363 |
AT_CHECK_M4([examples/fstab.m4], 0, |
AT_DATA([[fstab.m4]], |
364 |
|
[[define(`concat', `translit(``$*'', ` ')') |
365 |
|
define(`fsent', `format(`%-25s %-16s nfs %-16s 0 0', `$1:$2', `$3', concat$4)') |
366 |
|
|
367 |
|
fsent(freja, /home/gevn, /home/gevn, (rw, soft, bg, grpid)) |
368 |
|
fsent(freja, /home/freja, /home/freja, (rw, soft, grpid)) |
369 |
|
fsent(rimfaxe, /home/rimfaxe, /home/rimfaxe, (rw, soft, bg)) |
370 |
|
|
371 |
|
]]) |
372 |
|
|
373 |
|
AT_CHECK_M4([fstab.m4], 0, |
374 |
[[ |
[[ |
375 |
|
|
376 |
|
|
523 |
|
|
524 |
AT_SETUP([hanoi]) |
AT_SETUP([hanoi]) |
525 |
|
|
526 |
AT_CHECK_M4([examples/hanoi.m4], 0, |
AT_DATA([[hanoi.m4]], |
527 |
|
[[divert(-1) |
528 |
|
|
529 |
|
# move(from, to) |
530 |
|
define(`move', `Move one disk from `$1' to `$2'. |
531 |
|
') |
532 |
|
|
533 |
|
# _hanoi (cnt, from, to, aux) |
534 |
|
define(`_hanoi', `ifelse(eval(`$1'<=1), 1, `move($2, $3)', |
535 |
|
`_hanoi(decr($1), $2, $4, $3)move($2, $3)_hanoi(decr($1), $4, $3, $2)')') |
536 |
|
|
537 |
|
# hanoi (cnt) |
538 |
|
define(`hanoi', `_hanoi(`$1', source, destination, auxilliary)') |
539 |
|
|
540 |
|
# traceon(`move', `_hanoi', `decr') |
541 |
|
divert`'dnl |
542 |
|
|
543 |
|
hanoi(3) |
544 |
|
]]) |
545 |
|
|
546 |
|
AT_CHECK_M4([hanoi.m4], 0, |
547 |
[[ |
[[ |
548 |
Move one disk from source to destination. |
Move one disk from source to destination. |
549 |
Move one disk from source to auxilliary. |
Move one disk from source to auxilliary. |
596 |
|
|
597 |
AT_SETUP([include]) |
AT_SETUP([include]) |
598 |
|
|
599 |
|
AT_DATA([[include.m4]], |
600 |
|
[[Beginning. |
601 |
|
include(`NOFILE') |
602 |
|
Intermediate |
603 |
|
include(`incl-test.m4') |
604 |
|
After |
605 |
|
include(`NOFILE') |
606 |
|
very late |
607 |
|
]]) |
608 |
|
|
609 |
|
AT_DATA([[incl-test.m4]], |
610 |
|
[[dnl noauto |
611 |
|
`include test file.' |
612 |
|
define() |
613 |
|
]]) |
614 |
|
|
615 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
616 |
[[Beginning. |
[[Beginning. |
617 |
|
|
625 |
]]) |
]]) |
626 |
|
|
627 |
AT_DATA([[experr]], |
AT_DATA([[experr]], |
628 |
[[m4: ../examples/include.m4: 2: Cannot open NOFILE: No such file or directory |
[[m4: include.m4: 2: Cannot open NOFILE: No such file or directory |
629 |
m4: ../examples/include.m4: 6: Cannot open NOFILE: No such file or directory |
m4: include.m4: 6: Cannot open NOFILE: No such file or directory |
630 |
]]) |
]]) |
631 |
|
|
632 |
AT_CHECK_M4([-I $top_srcdir/examples examples/include.m4], 0, expout, experr) |
AT_CHECK_M4([include.m4], 0, expout, experr) |
633 |
|
|
634 |
AT_CLEANUP |
AT_CLEANUP |
635 |
|
|
654 |
>>>%%$$##<<< cnt 0 |
>>>%%$$##<<< cnt 0 |
655 |
]]) |
]]) |
656 |
|
|
657 |
AT_CHECK_M4([examples/indir.m4], 0, expout) |
AT_DATA([[indir.m4]], |
658 |
|
[[define(`%%$$##', `>>>$0<<< cnt $#') |
659 |
|
|
660 |
|
# indir(`%%$$##', nonsens, nonsens) |
661 |
|
indir(`%%$$##', nonsens, nonsens) |
662 |
|
|
663 |
|
# indir(`indir', `%%$$##', nonsens) |
664 |
|
indir(`indir', `%%$$##', nonsens) |
665 |
|
|
666 |
|
# indir(`indir', `indir', `indir', `indir', `%%$$##') |
667 |
|
indir(`indir', `indir', `indir', `indir', `%%$$##') |
668 |
|
]]) |
669 |
|
|
670 |
|
AT_CHECK_M4([indir.m4], 0, expout) |
671 |
|
|
672 |
AT_CLEANUP |
AT_CLEANUP |
673 |
|
|
723 |
|
|
724 |
EOF] |
EOF] |
725 |
|
|
726 |
AT_CHECK_M4([examples/misc.m4], 0, expout) |
AT_DATA([[misc.m4]], |
727 |
|
[[divert(-1) |
728 |
|
define(`USER', `root') |
729 |
|
define(`TMP', maketemp(`/tmp/hejXXXXXX')) |
730 |
|
syscmd(`grep "^'USER`:" /etc/passwd | awk -F: "{print \$3}"' > TMP) |
731 |
|
define(`UID', include(TMP)) |
732 |
|
syscmd(`rm -f' TMP) |
733 |
|
divert |
734 |
|
UID |
735 |
|
]]) |
736 |
|
|
737 |
|
AT_CHECK_M4([misc.m4], 0, expout) |
738 |
|
|
739 |
AT_CLEANUP |
AT_CLEANUP |
740 |
|
|
892 |
|
|
893 |
AT_SETUP([multiquotes]) |
AT_SETUP([multiquotes]) |
894 |
|
|
895 |
|
AT_DATA([[multiquotes.m4]], |
896 |
|
[[traceon |
897 |
|
changequote([,])dnl |
898 |
|
changequote([``], [''])dnl |
899 |
|
````traceon'''' |
900 |
|
define(``foo'', ````FOO'''')dnl |
901 |
|
dumpdef(``foo'')dnl |
902 |
|
changequote(``!'', ``!'')dnl |
903 |
|
!foo! |
904 |
|
foo |
905 |
|
dumpdef(!foo!)dnl |
906 |
|
define(!bar!, !BAR!) |
907 |
|
bar |
908 |
|
changequote(!>*>*>*>*>!, !<*<*<*<*<!)dnl five of each |
909 |
|
>*>*>*>*>foo bar<*<*<*<*< |
910 |
|
foo bar |
911 |
|
>*>*>*>*>*>*><*<*<*<*<*<*< |
912 |
|
dumpdef(>*>*>*>*>foo<*<*<*<*<, >*>*>*>*>bar<*<*<*<*<)dnl |
913 |
|
]]) |
914 |
|
|
915 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
916 |
[[ |
[[ |
917 |
``traceon'' |
``traceon'' |
948 |
m4trace: -1- dnl |
m4trace: -1- dnl |
949 |
]]) |
]]) |
950 |
|
|
951 |
AT_CHECK_M4([examples/multiquotes.m4], 0, expout, experr) |
AT_CHECK_M4([multiquotes.m4], 0, expout, experr) |
952 |
|
|
953 |
AT_CLEANUP |
AT_CLEANUP |
954 |
|
|
960 |
|
|
961 |
AT_SETUP([patsubst]) |
AT_SETUP([patsubst]) |
962 |
|
|
963 |
|
AT_DATA([[patsubst.m4]], |
964 |
|
[[# traceon(`patsubst') |
965 |
|
patsubst(`GNUs not Unix.', `^', `OBS: ') |
966 |
|
patsubst(`GNUs not Unix.', `\<', `OBS: ') |
967 |
|
patsubst(`GNUs not Unix.', `\<\w', `\0=') |
968 |
|
patsubst(`GNUs not Unix.', `\w*', `(\0)') |
969 |
|
patsubst(`GNUs not Unix.', `\w+', `(\0)') |
970 |
|
patsubst(`GNUs not Unix.', `\w+') |
971 |
|
patsubst(`GNUs not Unix.', `[ ]+', ` ') |
972 |
|
]]) |
973 |
|
|
974 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
975 |
[[# traceon(`patsubst') |
[[# traceon(`patsubst') |
976 |
OBS: GNUs not Unix. |
OBS: GNUs not Unix. |
983 |
]]) |
]]) |
984 |
|
|
985 |
AT_DATA([[experr]], |
AT_DATA([[experr]], |
986 |
[[m4: ../examples/patsubst.m4: 4: WARNING: \0 will disappear, use \& instead in replacements |
[[m4: patsubst.m4: 4: WARNING: \0 will disappear, use \& instead in replacements |
987 |
]]) |
]]) |
988 |
|
|
989 |
AT_CHECK_M4([examples/patsubst.m4], 0, expout, experr) |
AT_CHECK_M4([patsubst.m4], 0, expout, experr) |
990 |
|
|
991 |
AT_CLEANUP |
AT_CLEANUP |
992 |
|
|
998 |
|
|
999 |
AT_SETUP([pushdef/popdef]) |
AT_SETUP([pushdef/popdef]) |
1000 |
|
|
1001 |
AT_CHECK_M4([examples/pushpop.m4], 0, [], |
AT_DATA([[pushpop.m4]], |
1002 |
|
[[divert(-1) |
1003 |
|
pushdef(`hej', `def 1.') |
1004 |
|
dumpdef(`hej') |
1005 |
|
pushdef(`hej', `def 2.') |
1006 |
|
dumpdef(`hej') |
1007 |
|
pushdef(`hej', `def 3.') |
1008 |
|
dumpdef(`hej') |
1009 |
|
pushdef(`hej', `def 4.') |
1010 |
|
dumpdef(`hej') |
1011 |
|
|
1012 |
|
popdef(`hej') |
1013 |
|
dumpdef(`hej') |
1014 |
|
popdef(`hej') |
1015 |
|
dumpdef(`hej') |
1016 |
|
popdef(`hej') |
1017 |
|
dumpdef(`hej') |
1018 |
|
popdef(`hej') |
1019 |
|
dumpdef(`hej') |
1020 |
|
popdef(`hej') |
1021 |
|
dumpdef(`hej') |
1022 |
|
popdef(`hej') |
1023 |
|
|
1024 |
|
dumpdef(`mac2') |
1025 |
|
popdef(`mac2') |
1026 |
|
dumpdef(`mac2') |
1027 |
|
]]) |
1028 |
|
|
1029 |
|
AT_CHECK_M4([pushpop.m4], 0, [], |
1030 |
[[hej: `def 1.' |
[[hej: `def 1.' |
1031 |
hej: `def 2.' |
hej: `def 2.' |
1032 |
hej: `def 3.' |
hej: `def 3.' |
1034 |
hej: `def 3.' |
hej: `def 3.' |
1035 |
hej: `def 2.' |
hej: `def 2.' |
1036 |
hej: `def 1.' |
hej: `def 1.' |
1037 |
m4: ../examples/pushpop.m4: 18: Undefined name hej |
m4: pushpop.m4: 18: Undefined name hej |
1038 |
m4: ../examples/pushpop.m4: 20: Undefined name hej |
m4: pushpop.m4: 20: Undefined name hej |
1039 |
m4: ../examples/pushpop.m4: 23: Undefined name mac2 |
m4: pushpop.m4: 23: Undefined name mac2 |
1040 |
m4: ../examples/pushpop.m4: 25: Undefined name mac2 |
m4: pushpop.m4: 25: Undefined name mac2 |
1041 |
]]) |
]]) |
1042 |
|
|
1043 |
AT_CLEANUP |
AT_CLEANUP |
1050 |
|
|
1051 |
AT_SETUP([regexp]) |
AT_SETUP([regexp]) |
1052 |
|
|
1053 |
|
AT_DATA([[regexp.m4]], |
1054 |
|
[[traceon(`regexp')dnl |
1055 |
|
regexp(`hej med dig', `.*', `>>\0<<') |
1056 |
|
regexp(`hej med dig', `\w*', `>>\0<<') |
1057 |
|
regexp(`hej med dig', `.+', `>>\0<<') |
1058 |
|
regexp(`hej med dig', `m\w+', `>>\0<<') |
1059 |
|
regexp(`hej med dig', `m\(.*\)', `>>\0<< >>\1<<') |
1060 |
|
|
1061 |
|
regexp(`hej med dig', `.*') |
1062 |
|
regexp(`hej med dig', `\w*') |
1063 |
|
regexp(`hej med dig', `.+') |
1064 |
|
regexp(`hej med dig', `m\w+') |
1065 |
|
regexp(`hej med dig', `m\(.*\)') |
1066 |
|
]]) |
1067 |
|
|
1068 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
1069 |
[[>>hej med dig<< |
[[>>hej med dig<< |
1070 |
>>hej<< |
>>hej<< |
1080 |
]]) |
]]) |
1081 |
|
|
1082 |
AT_DATA([[experr]], |
AT_DATA([[experr]], |
1083 |
[[m4: ../examples/regexp.m4: 2: WARNING: \0 will disappear, use \& instead in replacements |
[[m4: regexp.m4: 2: WARNING: \0 will disappear, use \& instead in replacements |
1084 |
m4trace: -1- regexp(`hej med dig', `.*', `>>\0<<') -> `>>hej med dig<<' |
m4trace: -1- regexp(`hej med dig', `.*', `>>\0<<') -> `>>hej med dig<<' |
1085 |
m4trace: -1- regexp(`hej med dig', `\w*', `>>\0<<') -> `>>hej<<' |
m4trace: -1- regexp(`hej med dig', `\w*', `>>\0<<') -> `>>hej<<' |
1086 |
m4trace: -1- regexp(`hej med dig', `.+', `>>\0<<') -> `>>hej med dig<<' |
m4trace: -1- regexp(`hej med dig', `.+', `>>\0<<') -> `>>hej med dig<<' |
1093 |
m4trace: -1- regexp(`hej med dig', `m\(.*\)') -> `4' |
m4trace: -1- regexp(`hej med dig', `m\(.*\)') -> `4' |
1094 |
]]) |
]]) |
1095 |
|
|
1096 |
AT_CHECK_M4([examples/regexp.m4], 0, expout, experr) |
AT_CHECK_M4([regexp.m4], 0, expout, experr) |
1097 |
|
|
1098 |
AT_CLEANUP |
AT_CLEANUP |
1099 |
|
|
1105 |
|
|
1106 |
AT_SETUP([reverse]) |
AT_SETUP([reverse]) |
1107 |
|
|
1108 |
AT_CHECK_M4([examples/reverse.m4], 0, |
AT_DATA([[reverse.m4]], |
1109 |
|
[[define(`reverse', `ifelse(eval($# > 1), 1, `reverse(shift($@)), `$1'', ``$1'')') |
1110 |
|
``'' => reverse. |
1111 |
|
``hej'' => reverse(hej). |
1112 |
|
``hej, med, dig'' => reverse(hej, med, dig). |
1113 |
|
]]) |
1114 |
|
|
1115 |
|
AT_CHECK_M4([reverse.m4], 0, |
1116 |
[[ |
[[ |
1117 |
`' => . |
`' => . |
1118 |
`hej' => hej. |
`hej' => hej. |
1261 |
|
|
1262 |
AT_SETUP([sysv-args]) |
AT_SETUP([sysv-args]) |
1263 |
|
|
1264 |
|
AT_DATA([[sysv-args.m4]], |
1265 |
|
[[divert(-1) |
1266 |
|
define(`nargs', `$#') |
1267 |
|
define(`concat', `ifelse(1, $#, `$1', `$1` 'concat(shift($@))')') |
1268 |
|
traceon(`concat', `nargs') |
1269 |
|
divert |
1270 |
|
|
1271 |
|
nargs |
1272 |
|
nargs() |
1273 |
|
nargs(1,2,3,4,5,6) |
1274 |
|
|
1275 |
|
concat() |
1276 |
|
concat(`hej', `med', `dig') |
1277 |
|
concat(`hej', `med', `dig', `en gang igen') |
1278 |
|
concat(an, awful, lot, of, argument, at, least, more, that, ten, silly, arguments) |
1279 |
|
]]) |
1280 |
|
|
1281 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
1282 |
[[ |
[[ |
1283 |
|
|
1317 |
m4trace: -1- concat(`arguments') -> `ifelse(1, 1, `arguments', `arguments` 'concat(shift(`arguments'))')' |
m4trace: -1- concat(`arguments') -> `ifelse(1, 1, `arguments', `arguments` 'concat(shift(`arguments'))')' |
1318 |
]]) |
]]) |
1319 |
|
|
1320 |
AT_CHECK_M4([examples/sysv-args.m4], 0, [expout], [experr]) |
AT_CHECK_M4([sysv-args.m4], 0, [expout], [experr]) |
1321 |
|
|
1322 |
AT_CLEANUP |
AT_CLEANUP |
1323 |
|
|
1329 |
|
|
1330 |
AT_SETUP([trace]) |
AT_SETUP([trace]) |
1331 |
|
|
1332 |
|
AT_DATA([[trace.m4]], |
1333 |
|
[[divert(-1) |
1334 |
|
|
1335 |
|
# move(from, to) |
1336 |
|
define(`move', `Move one disk from `$1' to `$2'. |
1337 |
|
') |
1338 |
|
|
1339 |
|
# _hanoi (cnt, from, to, aux) |
1340 |
|
define(`_hanoi', `ifelse(eval(`$1'<=1), 1, `move($2, $3)', |
1341 |
|
`_hanoi(decr($1), $2, $4, $3)move($2, $3)_hanoi(decr($1), $4, $3, $2)')') |
1342 |
|
|
1343 |
|
# hanoi (cnt) |
1344 |
|
define(`hanoi', `_hanoi(`$1', source, destination, auxilliary)') |
1345 |
|
divert`'dnl |
1346 |
|
|
1347 |
|
# Debugmode t |
1348 |
|
debugmode(`t') |
1349 |
|
hanoi(2) |
1350 |
|
|
1351 |
|
# Debugmode taeq |
1352 |
|
debugmode(`taeq') |
1353 |
|
hanoi(2) |
1354 |
|
|
1355 |
|
# Debugmode OFF |
1356 |
|
debugmode |
1357 |
|
hanoi(2) |
1358 |
|
|
1359 |
|
# Debugmode ae |
1360 |
|
debugmode(`ae') |
1361 |
|
traceon(`move', `_hanoi') |
1362 |
|
hanoi(2) |
1363 |
|
]]) |
1364 |
|
|
1365 |
AT_DATA([[expout]], |
AT_DATA([[expout]], |
1366 |
[[ |
[[ |
1367 |
# Debugmode t |
# Debugmode t |
1447 |
|
|
1448 |
]]) |
]]) |
1449 |
|
|
1450 |
AT_CHECK_M4([examples/trace.m4], 0, expout, experr) |
AT_CHECK_M4([trace.m4], 0, expout, experr) |
1451 |
|
|
1452 |
AT_CLEANUP |
AT_CLEANUP |
1453 |
|
|
1459 |
|
|
1460 |
AT_SETUP([translit]) |
AT_SETUP([translit]) |
1461 |
|
|
1462 |
AT_CHECK_M4([examples/translit.m4], 0, |
AT_DATA([[translit.m4]], |
1463 |
|
[[# traceon(`translit')dnl |
1464 |
|
translit(`GNUs not Unix', `a-z') |
1465 |
|
translit(`GNUs not Unix', `a-z', `A-Z') |
1466 |
|
translit(`GNUs not Unix', `A-Z', `a-z') |
1467 |
|
translit(`GNUs not Unix', `A-Z') |
1468 |
|
translit(`a-z', `a-') |
1469 |
|
translit(`A-Z', `A-Z-', `-A-Z') |
1470 |
|
translit(`GNUs not Unix', `Z-A', `a-z') |
1471 |
|
]]) |
1472 |
|
|
1473 |
|
AT_CHECK_M4([translit.m4], 0, |
1474 |
[[# traceon(`translit')dnl |
[[# traceon(`translit')dnl |
1475 |
GNU U |
GNU U |
1476 |
GNUS NOT UNIX |
GNUS NOT UNIX |
1491 |
|
|
1492 |
AT_SETUP([undivert]) |
AT_SETUP([undivert]) |
1493 |
|
|
1494 |
# undivert.m4 `include's a file from examples/. |
AT_DATA([[undivert.m4]], |
1495 |
AT_CHECK_M4([-I $top_srcdir/examples examples/undivert.m4], 0, |
[[define(`undiverted', `UNDIVERTED') |
1496 |
|
# undiverted file. |
1497 |
|
undivert(`undivert.incl') |
1498 |
|
# included file. |
1499 |
|
include(`undivert.incl') |
1500 |
|
]]) |
1501 |
|
|
1502 |
|
AT_DATA([[undivert.incl]], |
1503 |
|
[[This is to be undiverted soon. |
1504 |
|
]]) |
1505 |
|
|
1506 |
|
AT_CHECK_M4([undivert.m4], 0, |
1507 |
[[ |
[[ |
1508 |
# undiverted file. |
# undiverted file. |
1509 |
This is to be undiverted soon. |
This is to be undiverted soon. |