| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 
 | # Empty values are permitted and reasonable, especially when just establishing
# expansion order.
#
# DEFINE: %{empty}=
# RUN: echo "'%{empty}'"
# CHECK:''
#
# REDEFINE: %{empty}=
# RUN: echo "'%{empty}'"
# CHECK:''
# A value consisting only of whitespace is trimmed to the empty string.
#
#               v~~ intentional whitespace
# DEFINE: %{ws}=   
# RUN: echo "'%{ws}'"
# CHECK:''
#
#                 v intentional whitespace
# REDEFINE: %{ws}= 
# RUN: echo "'%{ws}'"
# CHECK:''
# Whitespace is not required around the name or value.
#
# DEFINE:%{no-whitespace}=abc
# RUN: echo "'%{no-whitespace}'"
# CHECK:'abc'
#
# REDEFINE:%{no-whitespace}=HelloWorld
# RUN: echo "'%{no-whitespace}'"
# CHECK:'HelloWorld'
# Whitespace is not required between substitutions in a value.
#
# DEFINE: %{adjacent0} = foo
# DEFINE: %{adjacent1} = bar
# DEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}
# RUN: echo "'%{has-adjacent-substs}'"
# CHECK:'foobar'
#
# REDEFINE: %{has-adjacent-substs} = %{adjacent0}%{adjacent1}%{adjacent0}
# RUN: echo "'%{has-adjacent-substs}'"
# CHECK:'foobarfoo'
# Exact whitespace is preserved within the value, but whitespace enclosing the
# name or value is discarded.  ('%{' and '}' are part of the name, and
# whitespace in between isn't permitted.)
#
#                                       v~~ intentional whitespace
# DEFINE:   %{whitespace}  =  abc    def   
# RUN: echo "'%{whitespace}'"
# CHECK:'abc    def'
#                                      v intentional whitespace
# REDEFINE: %{whitespace} = Hello World 
# RUN: echo "'%{whitespace}'"
# CHECK:'Hello World'
# Line continuations in the value are permitted and collapse whitespace.
#
# DEFINE: %{continue} = abc\
# DEFINE:def \
# DEFINE:ghi\
# DEFINE: jkl \
# DEFINE: mno  \
# DEFINE:  pqr 
#             ^ intentional whitespace
# RUN: echo "'%{continue}'"
# CHECK:'abc def ghi jkl mno pqr'
#
# REDEFINE: %{continue} =  abc  \
# REDEFINE: def
# RUN: echo "'%{continue}'"
# CHECK:'abc def'
# Whitespace at the end of the line after a '\' is ignored, and it's treated as
# a line continuation.  Otherwise, the behavior would be hard to understand
# because it looks like a line continuation.
#
#                                   v~~~~~~~~~~~ intentional whitespace
# DEFINE: %{ws-after-continue}=foo \            
# DEFINE: bar                      \ 
#                                   ^ intentional whitespace
# DEFINE: baz
# RUN: echo "'%{ws-after-continue}'"
# CHECK:'foo bar baz'
#
#                                     v intentional whitespace
# REDEFINE: %{ws-after-continue}=foo \ 
# REDEFINE: bar                      \            
#                                     ^~~~~~~~~~~~ intentional whitespace
# REDEFINE: baz
# RUN: echo "'%{ws-after-continue}'"
# CHECK:'foo bar baz'
# A line continuation is recognized anywhere.  It should be used only where
# whitespace is permitted because it reduces to a single space.
#
# Directives with at least one non-whitespace character (could be '\') are
# permitted even if they contribute nothing to the value.  There might be no
# practical use, but check that it behaves as expected.
#
# DEFINE:\
# DEFINE:%{blank-lines}\
# DEFINE:\
# DEFINE:=\
# DEFINE:\
# DEFINE:a
# RUN: echo "'%{blank-lines}'"
# CHECK:'a'
#
# REDEFINE:                  \
# REDEFINE: %{blank-lines}   \
# REDEFINE:                  \
# REDEFINE:                = \
# REDEFINE:                  \
# REDEFINE:      a           \
# REDEFINE:                  \
# REDEFINE:      b           \
# REDEFINE:                  \
# REDEFINE:      c
# RUN: echo "'%{blank-lines}'"
# CHECK:'a b c'
# The fourth DEFINE line is deceptive because it looks like a new substitution,
# but it's actually a continuation of the previous value.
#
# DEFINE: %{name}=x
# DEFINE: %{value}=3
# DEFINE: %{deceptive-continue}=echo \
# DEFINE: %{name}=%{value}
# RUN: %{deceptive-continue}
# CHECK:x=3
# CHECK:{{ *}}Passed: 1
 |