1 # Empty values are permitted and reasonable, especially when just establishing
5 # RUN: echo "'%{empty}'"
9 # RUN: echo "'%{empty}'"
12 # A value consisting only of whitespace is trimmed to the empty string.
14 # v~~ intentional whitespace
19 # v intentional whitespace
24 # Whitespace is not required around the name or value.
26 # DEFINE:%{no-whitespace}=abc
27 # RUN: echo "'%{no-whitespace}'"
30 # REDEFINE:%{no-whitespace}=HelloWorld
31 # RUN: echo "'%{no-whitespace}'"
32 # CHECK:# | 'HelloWorld'
34 # Whitespace is not required between substitutions in a value.
36 # DEFINE: %{adjacent0} = foo
37 # DEFINE: %{adjacent1} = bar
38 # DEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}
39 # RUN: echo "'%{has-adjacent-substs}'"
42 # REDEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}%{adjacent0}
43 # RUN: echo "'%{has-adjacent-substs}'"
44 # CHECK:# | 'foobarfoo'
46 # Exact whitespace is preserved within the value, but whitespace enclosing the
47 # name or value is discarded. ('%{' and '}' are part of the name, and
48 # whitespace in between isn't permitted.)
50 # v~~ intentional whitespace
51 # DEFINE: %{whitespace} = abc def
52 # RUN: echo "'%{whitespace}'"
54 # v intentional whitespace
55 # REDEFINE: %{whitespace} = Hello World
56 # RUN: echo "'%{whitespace}'"
57 # CHECK:# | 'Hello World'
59 # Line continuations in the value are permitted and collapse whitespace.
61 # DEFINE: %{continue} = abc\
67 # ^ intentional whitespace
68 # RUN: echo "'%{continue}'"
69 # CHECK:# | 'abc def ghi jkl mno pqr'
71 # REDEFINE: %{continue} = abc \
73 # RUN: echo "'%{continue}'"
76 # Whitespace at the end of the line after a '\' is ignored, and it's treated as
77 # a line continuation. Otherwise, the behavior would be hard to understand
78 # because it looks like a line continuation.
80 # v~~~~~~~~~~~ intentional whitespace
81 # DEFINE: %{ws-after-continue}=foo \
83 # ^ intentional whitespace
85 # RUN: echo "'%{ws-after-continue}'"
86 # CHECK:# | 'foo bar baz'
88 # v intentional whitespace
89 # REDEFINE: %{ws-after-continue}=foo \
91 # ^~~~~~~~~~~~ intentional whitespace
93 # RUN: echo "'%{ws-after-continue}'"
94 # CHECK:# | 'foo bar baz'
96 # A line continuation is recognized anywhere. It should be used only where
97 # whitespace is permitted because it reduces to a single space.
99 # Directives with at least one non-whitespace character (could be '\') are
100 # permitted even if they contribute nothing to the value. There might be no
101 # practical use, but check that it behaves as expected.
104 # DEFINE:%{blank-lines}\
109 # RUN: echo "'%{blank-lines}'"
113 # REDEFINE: %{blank-lines} \
122 # RUN: echo "'%{blank-lines}'"
125 # The fourth DEFINE line is deceptive because it looks like a new substitution,
126 # but it's actually a continuation of the previous value.
130 # DEFINE: %{deceptive-continue}=echo \
131 # DEFINE: %{name}=%{value}
132 # RUN: %{deceptive-continue}
135 # CHECK:{{ *}}Passed: 1 {{\([0-9]*\.[0-9]*%\)}}