Debian Codegraph @

tests/m4sugar.at

raw
1 # -*- Autoconf -*-
2
3 AT_BANNER([M4sugar.])
4
5
6 # Order of the tests:
7 # - m4_warn
8 #
9 # - m4_require
10 # uses warn/error code.
11 #
12 # - m4_text_wrap
13
14 ## --------- ##
15 ## m4_warn. ##
16 ## --------- ##
17
18 AT_SETUP([[m4_warn]])
19
20 # m4_text_wrap is used to display the help strings. Also, check that
21 # commas are not swallowed. This can easily happen because of
22 # m4-listification.
23
24 AT_DATA(configure.ac,
25 [[m4_warn([foo], [foo])
26 m4_warn([bar], [bar])
27 m4_warn([syntax], [syntax])
28 ]])
29
30 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o-],
31 0, [],
32 [configure.ac:3: warning: syntax
33 ])
34
35 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wall],
36 0, [],
37 [configure.ac:1: warning: foo
38 configure.ac:2: warning: bar
39 configure.ac:3: warning: syntax
40 ])
41
42 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar],
43 0, [],
44 [configure.ac:2: warning: bar
45 ])
46
47 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar,error],
48 1, [],
49 [configure.ac:2: error: bar
50 configure.ac:2: the top level
51 ])
52
53 AT_CLEANUP
54
55
56 ## ----------------------------------- ##
57 ## m4_require: circular dependencies. ##
58 ## ----------------------------------- ##
59
60 AT_SETUP([[m4_require: circular dependencies]])
61
62 # m4_text_wrap is used to display the help strings. Also, check that
63 # commas are not swallowed. This can easily happen because of
64 # m4-listification.
65
66 AT_DATA([configure.ac],
67 [[m4_defun([foo],
68 [m4_require([bar])])
69
70 m4_defun([bar],
71 [m4_require([foo])])
72
73 m4_defun([baz],
74 [m4_require([foo])])
75
76 m4_init
77 baz
78 ]])
79
80 AT_CHECK_AUTOCONF([], 1, [],
81 [[configure.ac:11: error: m4_require: circular dependency of foo
82 configure.ac:11: foo is required by...
83 configure.ac:4: bar is expanded from...
84 configure.ac:11: bar is required by...
85 configure.ac:1: foo is expanded from...
86 configure.ac:11: foo is required by...
87 configure.ac:7: baz is expanded from...
88 configure.ac:11: the top level
89 ]])
90
91 AT_CLEANUP
92
93
94 ## -------------- ##
95 ## m4_text_wrap. ##
96 ## -------------- ##
97
98 AT_SETUP([[m4_text_wrap]])
99
100 # m4_text_wrap is used to display the help strings. Also, check that
101 # commas are not swallowed. This can easily happen because of
102 # m4-listification.
103
104 AT_DATA([configure.ac],
105 [[AC_PLAIN_SCRIPT()dnl
106 m4_text_wrap([Short string */], [ ], [/* ], 20)
107
108 m4_text_wrap([Much longer string */], [ ], [/* ], 20)
109
110 m4_text_wrap([Short doc.], [ ], [ --short ], 30)
111
112 m4_text_wrap([Short doc.], [ ], [ --too-wide], 30)
113
114 m4_text_wrap([Super long documentation.], [ ], [ --too-wide], 30)
115
116 m4_text_wrap([First, second , third, [,quoted]])
117 ]])
118
119 AT_DATA(expout,
120 [[/* Short string */
121
122 /* Much longer
123 string */
124
125 --short Short doc.
126
127 --too-wide
128 Short doc.
129
130 --too-wide
131 Super long
132 documentation.
133
134 First, second , third, [,quoted]
135 ]])
136
137 AT_CHECK_AUTOCONF([-o-], 0, [expout])
138
139 AT_CLEANUP