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-NOT command: more tests #3

Merged
merged 3 commits into from
Nov 17, 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
6 changes: 3 additions & 3 deletions src/FileCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def dump_check(check):
exit(1)

if current_check.check_type == CheckType.CHECK_NOT:
if current_check.match_type == MatchType.SUBSTRING:
if (current_check.match_type == MatchType.SUBSTRING or
current_check.match_type == MatchType.REGEX):
print("{}:{}:{}: error: CHECK-NOT: excluded string found in input"
.format(check_file, line_counter, current_check.start_index + 1))

Expand All @@ -209,5 +210,4 @@ def dump_check(check):
print("^".ljust(len(current_line), '~'))
exit(1)

if current_check.match_type == MatchType.REGEX:
assert 0, "Not implemented"
assert 0, "Not implemented"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; CHECK-NOT: hello
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? == 0;) | %FILECHECK_TESTER_EXEC %s
; CHECK: {{^.*}}FileCheck
; CHECK-EMPTY:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; CHECK-NOT: {{^h.l.o$}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? == 1;) | %FILECHECK_TESTER_EXEC %s
; CHECK: {{^.*}}FileCheck
; CHECK-NEXT: {{^.*}}filecheck.check:1:14: error: CHECK-NOT: excluded string found in input{{$}}
; TODO: Here we could do a better match.
; CHECK-NEXT: {{^; CHECK-NOT: ...h.l.o...$}}
; TODO: Real FileCheck ignores whitespaces even when regex is passed.
; TODO: The next step is to check the --strict-whitespace option.
; CHECK-NEXT: {{^ \^$}}
; CHECK-NEXT: {{^<stdin>:.*:.*: note: found here$}}
; CHECK-NEXT: {{^}}hello{{$}}
; CHECK-NEXT: {{^}}^~~~~{{$}}
; CHECK-EMPTY:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; CHECK-NOT: {{hello}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? == 0;) | %FILECHECK_TESTER_EXEC %s
; CHECK: {{^.*}}FileCheck
; CHECK-EMPTY: