5
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
5
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
6
# Free Software Foundation, Inc.
8
# This program is free software; you can redistribute it and/or modify
8
# This program is free software: you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
10
10
# the Free Software Foundation; either version 2, or (at your option)
11
11
# any later version.
163
AT_SETUP([AS@&t@_ECHO and AS@&t@_ECHO_N])
165
AT_DATA_M4SH([script.as],
168
m4_define([ECHO_TEST],
169
[echo=`AS_ECHO(['$1'])`
170
test "X$echo" = 'X$1' ||
171
echo "AS@&t@_ECHO('"'$1'"') outputs '$echo'" >&2
173
echo=`AS_ECHO_N(['$1'])`
174
test "X$echo" = 'X$1' ||
175
echo "AS@&t@_ECHO_N('"'$1'"') outputs '$echo'" >&2])
179
ECHO_TEST([---...---])
188
ECHO_TEST([\a\b\c\f\n\r\t\v\"\])
158
206
## ------------- ##
159
207
## AS_BASENAME. ##
160
208
## ------------- ##
444
492
## AS_HELP_STRING ##
445
493
## -------------- ##
447
# I'm not totally certain that we want to enforce the defaults here,
448
# but at least it is being tested.
450
495
AT_SETUP([AS@&t@_HELP_STRING])
496
AT_KEYWORDS([m4@&t@_text_wrap m4@&t@_expand])
452
498
AT_DATA_M4SH([script.as],
487
533
[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
488
534
echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123],
489
535
[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
536
echo "AS_HELP_STRING([[--foo[=bar]]],
537
[some other t[]t which should wrap at our default of 80 characters.])"
538
echo "AS_HELP_STRING([[--foo[=bar]123456789]],
539
[some other t[]t which should wrap at our default of 80 characters.])"
540
echo "AS_HELP_STRING([[--foo[=bar]1234567890]],
541
[some other t[]t which should wrap at our default of 80 characters.])"
542
echo "AS_HELP_STRING([[--foo[=bar]12345678901]],
543
[some other t[]t which should wrap at our default of 80 characters.])"
544
echo "AS_HELP_STRING([[--foo[=bar]123456789012]],
545
[some other t[]t which should wrap at our default of 80 characters.])"
546
echo "AS_HELP_STRING([[--foo[=bar]1234567890123]],
547
[some other t[]t which should wrap at our default of 80 characters.])"
548
m4_define([mac], [MACRO])dnl
549
echo "AS_HELP_STRING([--mac], [mac])"
550
echo "AS_HELP_STRING([--o1, --o2], [two
551
options, one description])"
552
echo "AS_HELP_STRING([[[--o3, --o4]]], [comma inside literal quoting])"
553
echo "AS_HELP_STRING([--tune1], [check out the tuned formatting],
555
echo "AS_HELP_STRING([--tune2], [check out the tuned formatting],
557
echo "AS_HELP_STRING([--tune3], [check out the tuned formatting],
559
echo "AS_HELP_STRING([--tune4], [check out the tuned formatting],
529
600
--foo[=bar]1234567890123
530
601
some other [ex] which should wrap at our default of
603
--foo[=bar] some other t[]t which should wrap at our default of
605
--foo[=bar]123456789 some other t[]t which should wrap at our default of
607
--foo[=bar]1234567890 some other t[]t which should wrap at our default of
609
--foo[=bar]12345678901 some other t[]t which should wrap at our default of
611
--foo[=bar]123456789012 some other t[]t which should wrap at our default of
613
--foo[=bar]1234567890123
614
some other t[]t which should wrap at our default of
617
--o1, --o2 two options, one description
618
[--o3, --o4] comma inside literal quoting
619
--tune1 check out the tuned formatting
620
--tune2 check out the tuned formatting
621
--tune3 check out the
624
--tune4 check out the tuned
541
635
AT_SETUP([AS@&t@_IF and AS@&t@_CASE])
637
AT_KEYWORDS([m4@&t@_transform_pair])
543
639
AT_DATA_M4SH([script.as], [[dnl
545
641
# Syntax checks: cope with empty arguments.
730
dnl stress test for large number of conditionals
731
dnl too large, and we start tickling shell bugs
732
m4_pushdef([limit], [1000])dnl
733
AT_DATA_M4SH([script.as], [[dnl
735
AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])))
736
AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])),
738
AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]))
739
AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]), [echo default])
742
dnl Add --force so autom4te doesn't think `script' is still up to date.
743
AT_CHECK_M4SH([--force])
744
AT_CHECK([./script 1], [0], [[1
749
AT_CHECK([./script limit], [0], [limit
754
AT_CHECK([./script default], [0], [[default
796
## ----------------- ##
797
## AS_INIT cleanup. ##
798
## ----------------- ##
800
AT_SETUP([AS@&t@_INIT cleanup])
802
AT_KEYWORDS([m4@&t@_wrap m4@&t@_wrap_lifo])
804
AT_DATA_M4SH([script.as], [[dnl
805
dnl Registered before AS_INIT's cleanups
806
m4_wrap([echo cleanup 1
809
dnl Registered after AS_INIT's cleanups, thus goes to KILL diversion
810
m4_wrap([echo cleanup 2
811
dnl However, nested wraps and diversions can still be used
812
dnl Also, test wrapping text that looks like parameter reference
813
m4_wrap([echo cleanup 3
814
m4_divert_text([M4SH-INIT], [m4_define([foo], [$1])dnl
817
dnl Registered before AS_INIT's cleanups
818
m4_wrap_lifo([echo cleanup 5
824
AT_CHECK([./script], [], [[prep 4