1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/FileCheck/verbose.txt
Thomas Preud'homme df37872b97 [FileCheck] Do not skip end of line in diagnostics
When commit da108b4ed4e6e7267701e76d5fd3b87609c9ab77 introduced
the CHECK-NEXT directive, it added logic to skip to the next line when
printing a diagnostic if the current matching position is at the end of
a line. This was fine while FileCheck did not support regular expression
but since it does now it can be confusing when the pattern to match
starts with the expectation of a newline (e.g. CHECK-NEXT: {{\n}}foo).
It is also inconsistent with the column information in the diagnostic
which does point to the end of line.

This commit removes this logic altogether, such that failure to match
diagnostic for such cases would show the end of line and be consistent
with the column information. The commit also adapts all existing
testcases accordingly.

Note to reviewers: An alternative approach would be to restrict the code
to only skip to the next line if the first character of the pattern is
known not to match a whitespace-like character. This would respect the
original intent but keep the inconsistency in terms of column info and
requires more code. I've only chosen this current approach by laziness
and would be happy to restrict the logic instead.

Reviewed By: jdenny, jhenderson

Differential Revision: https://reviews.llvm.org/D93341
2021-03-03 08:20:39 +00:00

200 lines
6.7 KiB
Plaintext

; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never --input-file %s %s 2>&1 | \
; RUN: FileCheck --check-prefix QUIET --allow-empty %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -v --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefix V %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -vv --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefixes V,VV %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -v -v --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefix V %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -vv -vv --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefixes V,VV %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -v -vv --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefixes V,VV %s
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck --dump-input=never -vv -v --input-file %s %s 2>&1 | \
; RUN: FileCheck --strict-whitespace --check-prefixes V,VV %s
; END.
foo
bar
CHECK: foo
CHECK-NOT: raboof
CHECK-NEXT: bar
V: verbose.txt:[[@LINE-4]]:8: remark: {{C}}HECK: expected string found in input
V-NEXT: {{C}}HECK: foo{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-9]]:1: note: found here
V-NEXT: {{^}}foo{{$}}
V-NEXT: {{^}}^~~{{$}}
V-NEXT: verbose.txt:[[@LINE-9]]:13: remark: {{C}}HECK-NEXT: expected string found in input
V-NEXT: {{C}}HECK-NEXT: bar{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-15]]:1: note: found here
V-NEXT: {{^}}bar{{$}}
V-NEXT: {{^}}^~~{{$}}
VV-NEXT: verbose.txt:[[@LINE-17]]:12: remark: {{C}}HECK-NOT: excluded string not found in input
VV-NEXT: {{C}}HECK-NOT: raboof{{$}}
VV-NEXT: {{^}} ^{{$}}
VV-NEXT: verbose.txt:[[@LINE-23]]:4: note: scanning from here
VV-NEXT: {{^}}foo{{$}}
VV-NEXT: {{^}} ^{{$}}
STRVAR=foobar
STRVAR:foobar
CHECK: STRVAR=[[STRVAR:[a-z]+]]
CHECK-NEXT: STRVAR:[[STRVAR]]
V: verbose.txt:[[#@LINE-3]]:8: remark: {{C}}HECK: expected string found in input
V-NEXT: {{C}}HECK: {{STRVAR=\[\[STRVAR:\[a-z\]\+\]\]}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[#@LINE-8]]:1: note: found here
V-NEXT: {{^}}STRVAR=foobar{{$}}
V-NEXT: {{^}}^~~~~~~~~~~~~{{$}}
V-NEXT: verbose.txt:[[#@LINE-11]]:8: note: captured var "STRVAR"
V-NEXT: {{^}}STRVAR=foobar{{$}}
V-NEXT: {{^}} ^~~~~~{{$}}
V-NEXT: verbose.txt:[[#@LINE-12]]:13: remark: {{C}}HECK-NEXT: expected string found in input
V-NEXT: {{C}}HECK-NEXT: {{STRVAR:\[\[STRVAR\]\]}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[#@LINE-17]]:1: note: found here
V-NEXT: {{^}}STRVAR:foobar{{$}}
V-NEXT: {{^}}^~~~~~~~~~~~~{{$}}
V-NEXT: verbose.txt:[[#@LINE-20]]:1: note: with "STRVAR" equal to "foobar"
V-NEXT: {{^}}STRVAR:foobar{{$}}
V-NEXT: {{^}}^{{$}}
NUMVAR=42
NUMVAR - 1:41
CHECK: NUMVAR=[[#NUMVAR:]]
CHECK-NOT: [[#NUMVAR + 1]]
CHECK-NEXT: NUMVAR - 1:[[#NUMVAR - 1]]
V: verbose.txt:[[#@LINE-4]]:8: remark: {{C}}HECK: expected string found in input
V-NEXT: {{C}}HECK: {{NUMVAR=[[][[]#NUMVAR:[]][]]$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[#@LINE-9]]:1: note: found here
V-NEXT: {{^}}NUMVAR=42{{$}}
V-NEXT: {{^}}^~~~~~~~~{{$}}
V-NEXT: verbose.txt:[[#@LINE-12]]:8: note: captured var "NUMVAR"
V-NEXT: NUMVAR=42
V-NEXT: ^~
V-NEXT: verbose.txt:[[#@LINE-12]]:13: remark: {{C}}HECK-NEXT: expected string found in input
V-NEXT: {{C}}HECK-NEXT: {{NUMVAR - 1:[[][[]#NUMVAR - 1[]][]]$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[#@LINE-18]]:1: note: found here
V-NEXT: {{^}}NUMVAR - 1:41{{$}}
V-NEXT: {{^}}^~~~~~~~~~~~~{{$}}
V-NEXT: verbose.txt:[[#@LINE-21]]:1: note: with "NUMVAR - 1" equal to "41"
V-NEXT: {{^}}NUMVAR - 1:41{{$}}
V-NEXT: {{^}}^{{$}}
VV-NEXT: verbose.txt:[[#@LINE-23]]:12: remark: {{C}}HECK-NOT: excluded string not found in input
VV-NEXT: {{C}}HECK-NOT: {{[[][[]#NUMVAR [+] 1[]][]]$}}
VV-NEXT: {{^}} ^{{$}}
VV-NEXT: verbose.txt:[[#@LINE-29]]:10: note: scanning from here
VV-NEXT: {{^}}NUMVAR=42{{$}}
VV-NEXT: {{^}} ^{{$}}
before empty
after empty
CHECK: before empty
CHECK-EMPTY:
CHECK-NEXT: after empty
V: verbose.txt:[[@LINE-4]]:8: remark: {{C}}HECK: expected string found in input
V-NEXT: {{C}}HECK: before empty{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-10]]:1: note: found here
V-NEXT: {{^}}before empty{{$}}
V-NEXT: {{^}}^~~~~~~~~~~~{{$}}
V-NEXT: verbose.txt:[[@LINE-10]]:13: remark: {{C}}HECK-EMPTY: expected string found in input
V-NEXT: {{C}}HECK-EMPTY:{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-16]]:1: note: found here
V-EMPTY:
V-NEXT: {{^}}^{{$}}
V-NEXT: verbose.txt:[[@LINE-16]]:13: remark: {{C}}HECK-NEXT: expected string found in input
V-NEXT: {{C}}HECK-NEXT: after empty{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-22]]:1: note: found here
V-NEXT: {{^}}after empty{{$}}
V-NEXT: {{^}}^~~~~~~~~~~{{$}}
abcdef
abcdef
CHECK-DAG: abcdef
CHECK-DAG: def
V-NEXT: verbose.txt:[[@LINE-3]]:12: remark: {{C}}HECK-DAG: expected string found in input
V-NEXT: {{C}}HECK-DAG: abcdef
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-8]]:1: note: found here
V-NEXT: {{^}}abcdef{{$}}
V-NEXT: {{^}}^~~~~~{{$}}
VV-NEXT: verbose.txt:[[@LINE-9]]:12: remark: {{C}}HECK-DAG: expected string found in input
VV-NEXT: {{C}}HECK-DAG: def
VV-NEXT: {{^}} ^{{$}}
VV-NEXT: verbose.txt:[[@LINE-15]]:4: note: found here
VV-NEXT: {{^abcdef$}}
VV-NEXT: {{^}} ^~~
VV-NEXT: verbose.txt:[[@LINE-18]]:1: note: match discarded, overlaps earlier DAG match here
VV-NEXT: {{^}}abcdef{{$}}
VV-NEXT: {{^}}^~~~~~{{$}}
V-NEXT: verbose.txt:[[@LINE-19]]:12: remark: {{C}}HECK-DAG: expected string found in input
V-NEXT: {{C}}HECK-DAG: def
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-24]]:4: note: found here
V-NEXT: {{^abcdef$}}
V-NEXT: {{^}} ^~~
xyz
CHECK: xyz
CHECK-NOT: {{z}}yx
V: verbose.txt:[[@LINE-3]]:8: remark: {{C}}HECK: expected string found in input
V-NEXT: {{C}}HECK: xyz{{$}}
V-NEXT: {{^}} ^{{$}}
V-NEXT: verbose.txt:[[@LINE-7]]:1: note: found here
V-NEXT: {{^}}xyz{{$}}
V-NEXT: {{^}}^~~{{$}}
VV-NEXT: verbose.txt:[[@LINE-9]]:19: remark: implicit EOF: expected string found in input
VV-NEXT: {{C}}HECK-NOT: {{[{][{]z[}][}]yx$}}
VV-NEXT: {{^}} ^{{$}}
VV-NEXT: verbose.txt:[[@LINE+13]]:1: note: found here
VV-NOT: {{.}}
VV: {{^}}^
VV-NEXT: verbose.txt:[[@LINE-16]]:12: remark: {{C}}HECK-NOT: excluded string not found in input
VV-NEXT: {{C}}HECK-NOT: {{[{][{]z[}][}]yx$}}
VV-NEXT: {{^}} ^{{$}}
VV-NEXT: verbose.txt:[[@LINE-21]]:4: note: scanning from here
VV-NEXT: {{^}}xyz{{$}}
VV-NEXT: {{^}} ^{{$}}
QUIET-NOT: {{.}}
V-NOT: {{.}}