Debian Codegraph @

llvm/utils/lit/tests/Inputs/shtest-define/ws-and-continuations.txt

raw
1 # Empty values are permitted and reasonable, especially when just establishing
2 # expansion order.
3 #
4 # DEFINE: %{empty}=
5 # RUN: echo "'%{empty}'"
6 # CHECK:# | ''
7 #
8 # REDEFINE: %{empty}=
9 # RUN: echo "'%{empty}'"
10 # CHECK:# | ''
11
12 # A value consisting only of whitespace is trimmed to the empty string.
13 #
14 # v~~ intentional whitespace
15 # DEFINE: %{ws}=
16 # RUN: echo "'%{ws}'"
17 # CHECK:# | ''
18 #
19 # v intentional whitespace
20 # REDEFINE: %{ws}=
21 # RUN: echo "'%{ws}'"
22 # CHECK:# | ''
23
24 # Whitespace is not required around the name or value.
25 #
26 # DEFINE:%{no-whitespace}=abc
27 # RUN: echo "'%{no-whitespace}'"
28 # CHECK:# | 'abc'
29 #
30 # REDEFINE:%{no-whitespace}=HelloWorld
31 # RUN: echo "'%{no-whitespace}'"
32 # CHECK:# | 'HelloWorld'
33
34 # Whitespace is not required between substitutions in a value.
35 #
36 # DEFINE: %{adjacent0} = foo
37 # DEFINE: %{adjacent1} = bar
38 # DEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}
39 # RUN: echo "'%{has-adjacent-substs}'"
40 # CHECK:# | 'foobar'
41 #
42 # REDEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}%{adjacent0}
43 # RUN: echo "'%{has-adjacent-substs}'"
44 # CHECK:# | 'foobarfoo'
45
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.)
49 #
50 # v~~ intentional whitespace
51 # DEFINE: %{whitespace} = abc def
52 # RUN: echo "'%{whitespace}'"
53 # CHECK:# | 'abc def'
54 # v intentional whitespace
55 # REDEFINE: %{whitespace} = Hello World
56 # RUN: echo "'%{whitespace}'"
57 # CHECK:# | 'Hello World'
58
59 # Line continuations in the value are permitted and collapse whitespace.
60 #
61 # DEFINE: %{continue} = abc\
62 # DEFINE:def \
63 # DEFINE:ghi\
64 # DEFINE: jkl \
65 # DEFINE: mno \
66 # DEFINE: pqr
67 # ^ intentional whitespace
68 # RUN: echo "'%{continue}'"
69 # CHECK:# | 'abc def ghi jkl mno pqr'
70 #
71 # REDEFINE: %{continue} = abc \
72 # REDEFINE: def
73 # RUN: echo "'%{continue}'"
74 # CHECK:# | 'abc def'
75
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.
79 #
80 # v~~~~~~~~~~~ intentional whitespace
81 # DEFINE: %{ws-after-continue}=foo \
82 # DEFINE: bar \
83 # ^ intentional whitespace
84 # DEFINE: baz
85 # RUN: echo "'%{ws-after-continue}'"
86 # CHECK:# | 'foo bar baz'
87 #
88 # v intentional whitespace
89 # REDEFINE: %{ws-after-continue}=foo \
90 # REDEFINE: bar \
91 # ^~~~~~~~~~~~ intentional whitespace
92 # REDEFINE: baz
93 # RUN: echo "'%{ws-after-continue}'"
94 # CHECK:# | 'foo bar baz'
95
96 # A line continuation is recognized anywhere. It should be used only where
97 # whitespace is permitted because it reduces to a single space.
98 #
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.
102 #
103 # DEFINE:\
104 # DEFINE:%{blank-lines}\
105 # DEFINE:\
106 # DEFINE:=\
107 # DEFINE:\
108 # DEFINE:a
109 # RUN: echo "'%{blank-lines}'"
110 # CHECK:# | 'a'
111 #
112 # REDEFINE: \
113 # REDEFINE: %{blank-lines} \
114 # REDEFINE: \
115 # REDEFINE: = \
116 # REDEFINE: \
117 # REDEFINE: a \
118 # REDEFINE: \
119 # REDEFINE: b \
120 # REDEFINE: \
121 # REDEFINE: c
122 # RUN: echo "'%{blank-lines}'"
123 # CHECK:# | 'a b c'
124
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.
127 #
128 # DEFINE: %{name}=x
129 # DEFINE: %{value}=3
130 # DEFINE: %{deceptive-continue}=echo \
131 # DEFINE: %{name}=%{value}
132 # RUN: %{deceptive-continue}
133 # CHECK:# | x=3
134
135 # CHECK:{{ *}}Passed: 1 {{\([0-9]*\.[0-9]*%\)}}