Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion filecheck/FileCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def __init__(self, failed_check):
self.failed_check = failed_check


class CheckNOTIsLastException(BaseException):
pass


class InputFinishedException(BaseException):
def __init__(self):
pass
Expand Down Expand Up @@ -390,7 +394,7 @@ def main():
current_check = next(check_iterator)
continue
except StopIteration:
exit(0)
raise CheckNOTIsLastException

elif check_result == CheckResult.FAIL_SKIP_LINE:
try:
Expand All @@ -417,6 +421,20 @@ def main():

current_check = still_actual_check
current_check_line_idx = line_idx
except CheckNOTIsLastException:
# Here we catch the case when the last check is known to be CHECK-NOT.
# We have to iterate over the remaining input lines and check them all
# against this last check.
try:
while True:
line_idx, line = next(stdin_input_iter)
input_lines.append(line)
if check_line(line, current_check, args.match_full_lines) == \
CheckResult.CHECK_NOT_MATCH:
current_check_line_idx = line_idx
break
except StopIteration:
exit(0)

except CheckFailedException as e:
current_check = e.failed_check.check
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; CHECK-NOT:String5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
String1
String2
String3
String4
String5
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? = 1;) | %FILECHECK_TESTER_EXEC %s --strict-whitespace --match-full-lines
; CHECK:{{^.*}}FileCheck{{(\.py)?$}}
; CHECK:{{^.*}}filecheck.check:1:13: error: CHECK-NOT: excluded string found in input{{$}}
; CHECK:; CHECK-NOT:String5
; CHECK: ^
; CHECK:<stdin>:5:1: note: found here
; CHECK:String5
; CHECK:^~~~~~~
; CHECK-EMPTY: