summaryrefslogtreecommitdiff
path: root/test/FileCheck
diff options
context:
space:
mode:
authorStephen Lin <stephenwlin@gmail.com>2013-07-12 14:51:05 +0000
committerStephen Lin <stephenwlin@gmail.com>2013-07-12 14:51:05 +0000
commit178504b07b793b3fde46d950b8f10e0794193e02 (patch)
treea0dcfce5f4676b3a3510cb8cb1a2409c0908e73a /test/FileCheck
parent5e102c6c48f2cdfe1741f60805c830fb1e17fa47 (diff)
downloadllvm-178504b07b793b3fde46d950b8f10e0794193e02.tar.gz
llvm-178504b07b793b3fde46d950b8f10e0794193e02.tar.bz2
llvm-178504b07b793b3fde46d950b8f10e0794193e02.tar.xz
Add new directive called CHECK-LABEL to FileCheck.
CHECK-LABEL is meant to be used in place on CHECK on lines containing identifiers or other unique labels (they need not actually be labels in the source or output language, though.) This is used to break up the input stream into separate blocks delineated by CHECK-LABEL lines, each of which is checked independently. This greatly improves the accuracy of errors and fix-it hints in many cases, and allows for FileCheck to recover from errors in one block by continuing to subsequent blocks. Some tests will be converted to use this new directive in forthcoming patches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FileCheck')
-rw-r--r--test/FileCheck/check-label.txt51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/FileCheck/check-label.txt b/test/FileCheck/check-label.txt
new file mode 100644
index 0000000000..27f0beeb29
--- /dev/null
+++ b/test/FileCheck/check-label.txt
@@ -0,0 +1,51 @@
+; RUN: FileCheck -input-file %s %s -check-prefix=CHECKOK
+; RUN: not FileCheck -input-file %s %s -check-prefix=CHECKFAIL 2>&1 | FileCheck %s -check-prefix=CHECKERROR
+
+label0:
+a
+b
+
+label1:
+b
+c
+
+label2:
+a
+c
+
+; CHECKOK-LABEL: {{^}}label0:
+; CHECKOK: {{^}}a
+; CHECKOK: {{^}}b
+
+; CHECKOK-LABEL: {{^}}label1:
+; CHECKOK: {{^}}b
+; CHECKOK: {{^}}c
+
+; CHECKOK-LABEL: {{^}}label2:
+; CHECKOK: {{^}}a
+; CHECKOK: {{^}}c
+
+; CHECKFAIL-LABEL: {{^}}label0:
+; CHECKFAIL: {{^}}a
+; CHECKFAIL: {{^}}b
+; CHECKFAIL: {{^}}c
+
+; CHECKERROR: expected string not found in input
+; CHECKERROR-NEXT: CHECKFAIL: {{[{][{]\^[}][}]}}c
+
+; CHECKFAIL-LABEL: {{^}}label1:
+; CHECKFAIL: {{^}}a
+; CHECKFAIL: {{^}}b
+; CHECKFAIL: {{^}}c
+
+; CHECKERROR: expected string not found in input
+; CHECKERROR-NEXT: CHECKFAIL: {{[{][{]\^[}][}]}}a
+
+; CHECKFAIL-LABEL: {{^}}label2:
+; CHECKFAIL: {{^}}a
+; CHECKFAIL: {{^}}b
+; CHECKFAIL: {{^}}c
+
+; CHECKERROR: expected string not found in input
+; CHECKERROR-NEXT: CHECKFAIL: {{[{][{]\^[}][}]}}b
+