3
3
AT_BANNER([M4sugar.])
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.
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
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
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])
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
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
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
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
333
341
AT_DATA_M4SUGAR([script.4s],
1134
1166
# m4-listification.
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],
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]))))
1847
1879
AT_CHECK_M4SUGAR([-o-], [0], [[48894
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]))))
1904
1936
AT_CHECK_M4SUGAR([-o-], [0], [[48894
2104
## ---------------------- ##
2105
## __file__ and __line__. ##
2106
## ---------------------- ##
2108
AT_SETUP([[__file__ and __line__]])
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
2120
m4_define([first], __line__)dnl
2121
m4_define([second], __line__)dnl
2122
m4_assert(first + 1 == second)dnl
2123
]], [[m4@&t@__@&t@file__