Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHECK-NEXT: negative regex match #55

Merged
merged 1 commit into from
Dec 11, 2019
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
5 changes: 3 additions & 2 deletions filecheck/FileCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ def main():
if current_check.check_type == CheckType.CHECK_NEXT:
last_read_line = input_lines[current_scan_base]

if current_check.match_type == MatchType.SUBSTRING:
if current_check.match_type == MatchType.SUBSTRING or \
current_check.match_type == MatchType.REGEX:
matching_line_idx = -1
for line_idx, line in stdin_input_iter:
line = line.rstrip()
Expand Down Expand Up @@ -432,7 +433,7 @@ def main():

exit(1)

assert 0, "Not implemented"
raise NotImplementedError()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; CHECK: string 1
; CHECK-NEXT: {{string 3}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
string 1
string 2
string 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; 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-NEXT:{{.*}}filecheck.check:2:15: error: CHECK-NEXT: is not on the line after the previous match{{$}}
; CHECK-NEXT:{{^; CHECK-NEXT: ..string 3..$}}
; CHECK-NEXT: ^
; CHECK-NEXT:<stdin>:3:1: note: 'next' match was here
; CHECK-NEXT:string 3
; CHECK-NEXT:^
; CHECK-NEXT:<stdin>:1:9: note: previous match ended here
; CHECK-NEXT:string 1
; CHECK-NEXT: ^
; CHECK-NEXT:<stdin>:2:1: note: non-matching line after previous match is here
; CHECK-NEXT:string 2
; CHECK-NEXT:^