[PATCH] D28896: [FileCheck] Add directive for checking for blank lines
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 03:20:13 PST 2017
jhenderson created this revision.
There is currently no reliable way in FileCheck to check that a line is completely empty. The expected way of using "CHECK: {{^$}}" does not work because the '^' matches the end of the previous match (this behaviour may be desirable in certain instances). For the same reason, "CHECK-NEXT: {{^$}}" will fail when the previous match was at the end of the line, as the pattern will match there. Using the recommended [[:space:]] to match an explicit new line could also match a space, and thus is not always desired. Literal '\n' matches also do not seem to work.
This change adds a new directive that behaves the same as CHECK-NEXT, except that it only matches against empty lines. As with CHECK-NEXT, it will fail if more than one newline occurs before the next blank line. Example usage:
; test.txt
foo
bar
; CHECK: foo
; CHECK-EMPTY:
; CHECK-NEXT: bar
https://reviews.llvm.org/D28896
Files:
docs/CommandGuide/FileCheck.rst
test/FileCheck/check-empty-tag.txt
utils/FileCheck/FileCheck.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28896.84952.patch
Type: text/x-patch
Size: 7528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170119/ce510d2c/attachment.bin>
More information about the llvm-commits
mailing list