blob: cb8dad4a4d9cfc966ea41c3dbc6b11f732f250f3 [file] [log] [blame]
# Check variable expansion.
#
# RUN: %{llbuild} ninja load-manifest %s > %t 2> %t.err
# RUN: %{FileCheck} < %t %s
# RUN: %{FileCheck} --check-prefix=CHECK-ERR < %t.err %s
# CHECK: Top-Level Bindings
# CHECK: a1 = "value1"
a1 = value1
# CHECK: a2 = "value2"
a2 = value2
# Check escape handling.
#
# CHECK: a3 = "x: $x"
a3 = x$:$ $$x
# CHECK: a4 = "xx"
a4 = x$
x
# Check expansion.
a5_sub_1 = value
a5_sub_2 = nextvalue
# CHECK: a5 = "xvaluenextvaluex"
a5 = x${a5_sub_1}${a5_sub_2}x
# CHECK: a6 = "x!valuenextvalue!x"
a6 = x!$a5_sub_1$a5_sub_2!x
# Check full range of expansion characters in simple variable references.
a7_azAZ09_- = value
# CHECK: a7 = "x.value.x"
a7 = x.$a7_azAZ09_-.x
# Check error handling for escapes and substitution
#
# CHECK-ERR: error: invalid '$'-escape (literal '$' should be written as '$$')
a8 = x$!x
# CHECK-ERR: error: invalid variable reference
a9 = x${foo
# CHECK-ERR: error: invalid variable name in reference
a10 = x${foo+bar}
# Check that bindings overwrite prior ones.
b1_sub = first
b1_sub = second
# CHECK: b1 = "x.second.x"
b1 = x.${b1_sub}.x
# Check error handling in deferred expansion.
#
# CHECK-ERR: error: invalid variable reference {{.*}} during evaluation of 'command'
rule DEFERRED
command = ECHO ${bar
build foo: DEFERRED