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

« back to all changes in this revision

Viewing changes to tests/m4sugar.at

  • Committer: Bazaar Package Importer
  • Author(s): Ben Pfaff
  • Date: 2010-08-02 13:04:28 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100802130428-ywor783c4eglymoq
Tags: 2.67-1
New upstream release.  Closes: #589958.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
AT_BANNER([M4sugar.])
4
4
 
5
 
# Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009 Free
6
 
# Software Foundation, Inc.
 
5
# Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009, 2010
 
6
# Free Software Foundation, Inc.
7
7
#
8
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
26
26
[
27
27
AT_DATA_M4SUGAR([script.4s],
28
28
[[m4_init
29
 
m4_divert_push(0)[]dnl
 
29
m4_divert_push([])[]dnl
30
30
]$1[[]dnl
31
 
m4_divert_pop(0)
 
31
m4_divert_pop([])
32
32
]])
33
33
 
34
34
AT_CHECK_M4SUGAR([-o-],, [$2], [$3])
245
245
 
246
246
AT_SETUP([m4@&t@_warn])
247
247
 
248
 
# m4_text_wrap is used to display the help strings.  Also, check that
249
 
# commas are not swallowed.  This can easily happen because of
250
 
# m4-listification.
251
 
 
252
248
# FIXME: For the time being we use -f to make sure we do issue the
253
249
# warnings.  But maybe autom4te should handle that by itself?
254
250
 
263
259
]])
264
260
 
265
261
AT_CHECK_M4SUGAR([-o-], 0, [],
266
 
[script.4s:7: warning: syntax
 
262
[script.4s:4: warning: prefer named diversions
 
263
script.4s:7: warning: syntax
267
264
])
268
265
 
269
266
AT_CHECK_M4SUGAR([-o- -Wall -f], 0, [],
270
 
[script.4s:5: warning: obsolete
 
267
[script.4s:4: warning: prefer named diversions
 
268
script.4s:5: warning: obsolete
271
269
script.4s:6: warning: cross
272
270
script.4s:2: cross_warning is expanded from...
273
271
script.4s:6: the top level
297
295
AT_KEYWORDS([m4@&t@_divert m4@&t@_divert_push m4@&t@_divert_pop
298
296
m4@&t@_undivert m4@&t@_cleardivert m4@&t@_divert_text])
299
297
 
300
 
AT_CHECK_M4SUGAR_TEXT([[1.m4_divert_stack
301
 
m4_divert_push([10])2.m4_divert_stack
302
 
m4_divert_text([20], [3.m4_divert_stack])dnl
303
 
m4_divert([30])4.m4_divert_stack
304
 
m4_divert_pop([30])dnl
305
 
5.m4_undivert([20], [30])
 
298
dnl This test names some diversions to avoid a warning.
 
299
AT_CHECK_M4SUGAR_TEXT([[m4_define([_m4_divert(ten)], [10])dnl
 
300
m4_define([_m4_divert(twenty)], [20])dnl
 
301
m4_define([_m4_divert(thirty)], [30])dnl
 
302
1.m4_divert_stack
 
303
m4_divert_push([ten])2.m4_divert_stack
 
304
m4_divert_text([twenty], [3.m4_divert_stack])dnl
 
305
m4_divert([thirty])4.m4_divert_stack
 
306
m4_divert_pop([thirty])dnl
 
307
5.m4_undivert([twenty], [thirty])
306
308
m4_pattern_allow([^m4_divert])dnl
307
 
]], [[1.script.4s:2: m4@&t@_divert_push: 0
308
 
script.4s:1: m4@&t@_divert: KILL
309
 
5.3.script.4s:5: m4@&t@_divert_push: 20
310
 
script.4s:4: m4@&t@_divert_push: 10
311
 
script.4s:2: m4@&t@_divert_push: 0
312
 
script.4s:1: m4@&t@_divert: KILL
313
 
4.script.4s:6: m4@&t@_divert: 30
314
 
script.4s:2: m4@&t@_divert_push: 0
 
309
]], [[1.script.4s:2: m4@&t@_divert_push:
 
310
script.4s:1: m4@&t@_divert: KILL
 
311
5.3.script.4s:8: m4@&t@_divert_push: twenty
 
312
script.4s:7: m4@&t@_divert_push: ten
 
313
script.4s:2: m4@&t@_divert_push:
 
314
script.4s:1: m4@&t@_divert: KILL
 
315
4.script.4s:9: m4@&t@_divert: thirty
 
316
script.4s:2: m4@&t@_divert_push:
315
317
script.4s:1: m4@&t@_divert: KILL
316
318
 
317
 
2.script.4s:4: m4@&t@_divert_push: 10
318
 
script.4s:2: m4@&t@_divert_push: 0
 
319
2.script.4s:7: m4@&t@_divert_push: ten
 
320
script.4s:2: m4@&t@_divert_push:
319
321
script.4s:1: m4@&t@_divert: KILL
320
322
]])
321
323
 
328
330
]],
329
331
[[one
330
332
four
 
333
]],
 
334
[[script.4s:4: warning: prefer named diversions
 
335
script.4s:5: warning: prefer named diversions
 
336
script.4s:6: warning: prefer named diversions
 
337
script.4s:7: warning: prefer named diversions
 
338
script.4s:8: warning: prefer named diversions
331
339
]])
332
340
 
333
341
AT_DATA_M4SUGAR([script.4s],
1004
1012
[[m4_init[]dnl
1005
1013
m4_append_uniq([str], [a], [ ])
1006
1014
m4_append_uniq([str], [a b], [ ])
1007
 
m4_divert([0])dnl
 
1015
m4_divert([])dnl
1008
1016
str
1009
1017
]])
1010
1018
 
1122
1130
AT_CLEANUP
1123
1131
 
1124
1132
 
 
1133
## ------------- ##
 
1134
## m4_text_box.  ##
 
1135
## ------------- ##
 
1136
 
 
1137
AT_SETUP([m4@&t@_text_box])
 
1138
 
 
1139
AT_CHECK_M4SUGAR_TEXT([[
 
1140
m4_text_box([a $1 @&t@b])
 
1141
m4_text_box([a $1 @&t@b], [$])
 
1142
m4_text_box([a $1 @&t@b], [,])
 
1143
]], [[
 
1144
## ------ ##
 
1145
## a $1 b ##
 
1146
## ------ ##
 
1147
## $$$$$$ ##
 
1148
## a $1 b ##
 
1149
## $$$$$$ ##
 
1150
## ,,,,,, ##
 
1151
## a $1 b ##
 
1152
## ,,,,,, ##
 
1153
]])
 
1154
 
 
1155
AT_CLEANUP
 
1156
 
1125
1157
## -------------- ##
1126
1158
## m4_text_wrap.  ##
1127
1159
## -------------- ##
1134
1166
# m4-listification.
1135
1167
 
1136
1168
AT_DATA_M4SUGAR([script.4s],
1137
 
[[m4_init[]m4_divert([0])dnl
 
1169
[[m4_init[]m4_divert([])dnl
1138
1170
m4_define([a], [OOPS])dnl
1139
1171
m4_escape([a[b $c#]d])
1140
1172
m4_if(m4_escape([a[b $c#]d]), [a[b $c#]d], [oops],
1820
1852
dnl undefined to exercise the alternate code path.
1821
1853
AT_DATA_M4SUGAR([script.4s],
1822
1854
[[m4_init
1823
 
m4_divert_push(0)[]dnl
 
1855
m4_divert_push([])[]dnl
1824
1856
m4_len(m4_foreach_w([j], m4_do(m4_for([i], [1], [10000], [], [,i ])), [j ]))
1825
1857
m4_shiftn(9998m4_for([i], [1], [10000], [], [,i]))
1826
1858
m4_len(m4_join([--],, m4_dquote_elt(m4_for([i], [1], [10000], [], [,i])),))
1841
1873
m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops]) j
1842
1874
m4_count(m4_map_args_pair([,m4_quote], []m4_map_args([,m4_echo]m4_for([i],
1843
1875
  [1], [10000], [], [,i]))))
1844
 
m4_divert_pop(0)
 
1876
m4_divert_pop([])
1845
1877
]])
1846
1878
 
1847
1879
AT_CHECK_M4SUGAR([-o-], [0], [[48894
1862
1894
AT_DATA_M4SUGAR([script.4s],
1863
1895
[[m4_ifdef([__m4_version__],
1864
1896
[m4_undefine([__m4_version__])],
1865
 
[m4_divert_push(0)48894
 
1897
[m4_divert_push([])48894
1866
1898
9999,10000
1867
1899
78896
1868
1900
58894
1877
1909
5001
1878
1910
m4_exit([0])])
1879
1911
m4_init
1880
 
m4_divert_push(0)[]dnl
 
1912
m4_divert_push([])[]dnl
1881
1913
m4_len(m4_foreach_w([j], m4_do(m4_for([i], [1], [10000], [], [,i ])), [j ]))
1882
1914
m4_shiftn(9998m4_for([i], [1], [10000], [], [,i]))
1883
1915
m4_len(m4_join([--],, m4_dquote_elt(m4_for([i], [1], [10000], [], [,i])),))
1898
1930
m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops]) j
1899
1931
m4_count(m4_map_args_pair([,m4_quote], []m4_map_args([,m4_echo]m4_for([i],
1900
1932
  [1], [10000], [], [,i]))))
1901
 
m4_divert_pop(0)
 
1933
m4_divert_pop([])
1902
1934
]])
1903
1935
 
1904
1936
AT_CHECK_M4SUGAR([-o-], [0], [[48894
2067
2099
]])
2068
2100
 
2069
2101
AT_CLEANUP
 
2102
 
 
2103
 
 
2104
## ---------------------- ##
 
2105
## __file__ and __line__. ##
 
2106
## ---------------------- ##
 
2107
 
 
2108
AT_SETUP([[__file__ and __line__]])
 
2109
 
 
2110
# Check that __file__ and __line__ work.
 
2111
# Check that m4__file__ and m4__line__ are not defined
 
2112
# (and get them to pass by the undefined-macro check).
 
2113
# Try to not assume too much about AT_CHECK_M4SUGAR_TEXT.
 
2114
AT_CHECK_M4SUGAR_TEXT([[dnl
 
2115
m4_pattern_allow([m4__file__])dnl
 
2116
m4_pattern_allow([m4__line__])dnl
 
2117
m4__file__
 
2118
m4__line__
 
2119
__file__
 
2120
m4_define([first], __line__)dnl
 
2121
m4_define([second], __line__)dnl
 
2122
m4_assert(first + 1 == second)dnl
 
2123
]], [[m4@&t@__@&t@file__
 
2124
m4@&t@__@&t@line__
 
2125
script.4s
 
2126
]])
 
2127
 
 
2128
AT_CLEANUP