Skip to content

Commit

Permalink
Merge pull request #3 from stanislaw/develop
Browse files Browse the repository at this point in the history
CHECK-NOT command: more tests
  • Loading branch information
stanislaw authored Nov 17, 2019
2 parents 20c0cca + ab8e2cb commit 9f0f8f1
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 3 deletions.
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:

0 comments on commit 9f0f8f1

Please sign in to comment.