xref: /llvm-project/llvm/utils/lit/tests/Inputs/shtest-define/expansion-order.txt (revision 0b7ae41b23fc05c2ac3afc8566b8a923d7f76c45)
1# Redefine the %{global:greeting} parameter of %{global:echo} before using it.
2# The necessary expansion order was established in the test suite config
3# (%{global:echo} before %{global:greeting}), and redefining the parameter
4# doesn't change that expansion order.  That order would be reversed if
5# %{global:greeting} were handled as a new substitution, preventing full
6# expansion.
7#
8# REDEFINE: %{global:greeting}=Hello
9# RUN: %{global:echo}
10# CHECK:# | GLOBAL: Hello World
11
12# We can redefine the test suite config's substitutions multiple times.  Again,
13# the expansion order remains the same (%{global:echo} before %{global:greeting}
14# before %{global:what}) but would be reversed if these were handled as new
15# substitutions, preventing full expansion.
16#
17# REDEFINE: %{global:greeting}=Goodbye %{global:what}
18# REDEFINE: %{global:what}=Sleep
19# RUN: %{global:echo}
20# CHECK:# | GLOBAL: Goodbye Sleep Sleep
21
22# A new local substitution is prepended to the substitution list so that it can
23# depend on all substitutions that were defined previously, including those from
24# the test suite config.
25#
26# DEFINE: %{local:greeting}=Hey %{global:what}
27# DEFINE: %{local:echo}=echo "LOCAL: %{local:greeting} %{global:what}"
28# RUN: %{local:echo}
29# CHECK:# | LOCAL: Hey Sleep Sleep
30
31# As for substitutions from the test suite config, redefining local
32# substitutions should not change the expansion order.  Again, the expansion
33# order would be reversed if these were instead handled as new substitutions,
34# preventing full expansion.
35#
36# REDEFINE: %{local:greeting}=So Long %{global:what}
37# REDEFINE: %{global:what}=World
38# RUN: %{local:echo}
39# CHECK:# | LOCAL: So Long World World
40
41# CHECK: Passed: 1 {{\([0-9]*.[0-9]*%\)}}
42