Skip to content

Commit

Permalink
Merge pull request #55 from stanislaw/develop
Browse files Browse the repository at this point in the history
CHECK-NEXT: negative regex match
  • Loading branch information
stanislaw authored Dec 11, 2019
2 parents 36b031b + 5fe85c5 commit e63cc99
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
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:^

0 comments on commit e63cc99

Please sign in to comment.