xref: /llvm-project/llvm/utils/lit/tests/Inputs/shtest-define/line-number-substitutions.txt (revision 0b7ae41b23fc05c2ac3afc8566b8a923d7f76c45)
1# Does it work as expected directly in RUN lines?
2# RUN: echo %(line), %(line-1), %(line+2)
3# CHECK:# | [[#@LINE-1]], [[#@LINE-2]], [[#@LINE+1]]
4
5# %(line) substitutions refer to the original DEFINE/REDEFINE line not the RUN
6# line they eventually appear within.
7#
8# DEFINE: %{lines} = %(line)
9# RUN: echo '%{lines}'
10# CHECK:# | [[#@LINE-2]]
11#
12# REDEFINE: %{lines} = %(line),                                                \
13# REDEFINE:            %(line),                                                \
14# REDEFINE:            %(line)
15# RUN: echo '%{lines}'
16# CHECK:# | [[#@LINE-4]], [[#@LINE-3]], [[#@LINE-2]]
17
18# %(line+N) and %{line-N) should work too.
19#
20# DEFINE: %{lines-rel} = %(line+1),                                            \
21# DEFINE:                %(line),                                              \
22# DEFINE:                %(line-1)
23# RUN: echo '%{lines-rel}'
24# CHECK:# | [[#@LINE-3]], [[#@LINE-3]], [[#@LINE-3]]
25#
26# REDEFINE: %{lines-rel} = %(line+5),                                          \
27# REDEFINE:                %(line+0),                                          \
28# REDEFINE:                %(line-10)
29# RUN: echo '%{lines-rel}'
30# CHECK:# | [[#@LINE+1]], [[#@LINE-3]], [[#@LINE-12]]
31
32# CHECK: Passed: 1 {{\([0-9]*.[0-9]*%\)}}
33