~ubuntu-branches/ubuntu/saucy/autoconf/saucy

« back to all changes in this revision

Viewing changes to tests/m4sh.at

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-02-10 11:19:19 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090210111919-em4fvdv91rsn40sb
Tags: 2.63-2ubuntu1
* Merge from Debian experimental, remaining changes:
  * bin/autoreconf.in: Check whether libtoolize supports --install, if it
    does, libtoolize is safe to run at all times since it will not install
    new files unless --install is passed to it as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
AT_BANNER([M4sh.])
4
4
 
5
 
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
6
 
# Foundation, Inc.
 
5
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 
6
# Free Software Foundation, Inc.
7
7
#
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.
56
56
fi
57
57
_AS@&t@_PREPARE
58
58
echo "Line: $3"
59
 
grep 'Line: .*$4' $[0] >/dev/null ||
 
59
grep 'Line: .*$4' "$[0]" >/dev/null ||
60
60
  AS@&t@_ERROR([cannot find original script])
61
61
exit 0
62
62
]])
155
155
 
156
156
 
157
157
 
 
158
## --------- ##
 
159
## AS_ECHO.  ##
 
160
## --------- ##
 
161
 
 
162
# Build nested dirs.
 
163
AT_SETUP([AS@&t@_ECHO and AS@&t@_ECHO_N])
 
164
 
 
165
AT_DATA_M4SH([script.as],
 
166
[[AS_INIT
 
167
 
 
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
 
172
 
 
173
echo=`AS_ECHO_N(['$1'])`
 
174
test "X$echo" = 'X$1' ||
 
175
  echo "AS@&t@_ECHO_N('"'$1'"') outputs '$echo'" >&2])
 
176
 
 
177
ECHO_TEST([-])
 
178
ECHO_TEST([--])
 
179
ECHO_TEST([---...---])
 
180
ECHO_TEST([      ])
 
181
ECHO_TEST([-e])
 
182
ECHO_TEST([-E])
 
183
ECHO_TEST([-n])
 
184
ECHO_TEST([-n -n])
 
185
ECHO_TEST([-e -n])
 
186
ECHO_TEST([ab\ncd])
 
187
ECHO_TEST([abcd\c])
 
188
ECHO_TEST([\a\b\c\f\n\r\t\v\"\])
 
189
ECHO_TEST([ab
 
190
cd
 
191
e])
 
192
ECHO_TEST([
 
193
 ])
 
194
ECHO_TEST([
 
195
\c])
 
196
AS_EXIT(0)
 
197
]])
 
198
 
 
199
AT_CHECK_M4SH
 
200
AT_CHECK([./script])
 
201
 
 
202
AT_CLEANUP
 
203
 
 
204
 
 
205
 
158
206
## ------------- ##
159
207
## AS_BASENAME.  ##
160
208
## ------------- ##
444
492
## AS_HELP_STRING ##
445
493
## -------------- ##
446
494
 
447
 
# I'm not totally certain that we want to enforce the defaults here,
448
 
# but at least it is being tested.
449
 
 
450
495
AT_SETUP([AS@&t@_HELP_STRING])
 
496
AT_KEYWORDS([m4@&t@_text_wrap m4@&t@_expand])
451
497
 
452
498
AT_DATA_M4SH([script.as],
453
499
[[AS_INIT
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],
 
554
[            ])"
 
555
echo "AS_HELP_STRING([--tune2], [check out the tuned formatting],
 
556
[12])"
 
557
echo "AS_HELP_STRING([--tune3], [check out the tuned formatting],
 
558
[], [40])"
 
559
echo "AS_HELP_STRING([--tune4], [check out the tuned formatting],
 
560
[12], [40])"
490
561
]])
491
562
 
492
563
AT_CHECK_M4SH
529
600
  --foo[=bar]1234567890123
530
601
                          some other [ex] which should wrap at our default of
531
602
                          80 characters.
 
603
  --foo[=bar]             some other t[]t which should wrap at our default of
 
604
                          80 characters.
 
605
  --foo[=bar]123456789    some other t[]t which should wrap at our default of
 
606
                          80 characters.
 
607
  --foo[=bar]1234567890   some other t[]t which should wrap at our default of
 
608
                          80 characters.
 
609
  --foo[=bar]12345678901  some other t[]t which should wrap at our default of
 
610
                          80 characters.
 
611
  --foo[=bar]123456789012 some other t[]t which should wrap at our default of
 
612
                          80 characters.
 
613
  --foo[=bar]1234567890123
 
614
                          some other t[]t which should wrap at our default of
 
615
                          80 characters.
 
616
  --MACRO                 mac
 
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
 
622
                          tuned
 
623
                          formatting
 
624
  --tune4   check out the tuned
 
625
            formatting
532
626
]])
533
627
 
534
628
AT_CLEANUP
540
634
 
541
635
AT_SETUP([AS@&t@_IF and AS@&t@_CASE])
542
636
 
 
637
AT_KEYWORDS([m4@&t@_transform_pair])
 
638
 
543
639
AT_DATA_M4SH([script.as], [[dnl
544
640
AS_INIT
545
641
# Syntax checks: cope with empty arguments.
631
727
foo9=9 bar9=9
632
728
]])
633
729
 
 
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
 
734
AS_INIT
 
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])),
 
737
      [echo default])
 
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])
 
740
]])
 
741
 
 
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
 
745
1
 
746
1
 
747
1
 
748
]])
 
749
AT_CHECK([./script limit], [0], [limit
 
750
limit
 
751
limit
 
752
limit
 
753
])
 
754
AT_CHECK([./script default], [0], [[default
 
755
default
 
756
]])
 
757
m4_popdef([limit])
 
758
 
634
759
AT_CLEANUP
635
760
 
636
761
 
666
791
]])
667
792
 
668
793
AT_CLEANUP
 
794
 
 
795
 
 
796
## ----------------- ##
 
797
## AS_INIT cleanup.  ##
 
798
## ----------------- ##
 
799
 
 
800
AT_SETUP([AS@&t@_INIT cleanup])
 
801
 
 
802
AT_KEYWORDS([m4@&t@_wrap m4@&t@_wrap_lifo])
 
803
 
 
804
AT_DATA_M4SH([script.as], [[dnl
 
805
dnl Registered before AS_INIT's cleanups
 
806
m4_wrap([echo cleanup 1
 
807
])
 
808
AS_INIT
 
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
 
815
echo prep foo([4])
 
816
])])])
 
817
dnl Registered before AS_INIT's cleanups
 
818
m4_wrap_lifo([echo cleanup 5
 
819
])
 
820
echo body
 
821
]])
 
822
 
 
823
AT_CHECK_M4SH
 
824
AT_CHECK([./script], [], [[prep 4
 
825
body
 
826
cleanup 5
 
827
cleanup 1
 
828
]])
 
829
 
 
830
AT_CLEANUP