| ; basic functionality | |
| ; RUN: FileCheck %s --input-file %s --check-prefix=CHECK1 | |
| foo | |
| bar | |
| CHECK1: foo | |
| CHECK1-EMPTY: | |
| CHECK1-NEXT: bar | |
| ; next line must be blank | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK2A 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK2B | |
| badger | |
| CHECK2A: badger | |
| CHECK2A-EMPTY: | |
| CHECK2B: CHECK2A-EMPTY: is not on the line after the previous match | |
| ; CHECK-EMPTY must have empty pattern | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK3A 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK3B | |
| CHECK3A: foo | |
| CHECK3A-EMPTY: this is not empty | |
| CHECK3B: found non-empty check string for empty check with prefix 'CHECK3A:' | |
| ; CHECK-EMPTY cannot be the first check | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK4A 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK4B | |
| CHECK4A-EMPTY: | |
| CHECK4B: found 'CHECK4A-EMPTY' without previous 'CHECK4A: line | |
| ; CHECK-EMPTY at EOF without trailing newline cannot be the first check. | |
| ; RUN: printf "# CHECK-EMPTY:" > %t.no-newline-fail.chk | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck --allow-empty --input-file=/dev/null %t.no-newline-fail.chk 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK4C | |
| CHECK4C: found 'CHECK-EMPTY' without previous 'CHECK: line | |
| ; CHECK-EMPTY at EOF without trailing newline still works after a prior check. | |
| ; RUN: printf "foo\n\n" > %t.no-newline-success.in | |
| ; RUN: printf "CHECK: foo\nCHECK-EMPTY:" > %t.no-newline-success.chk | |
| ; RUN: FileCheck --input-file=%t.no-newline-success.in %t.no-newline-success.chk | |
| ; CHECK-EMPTY-NOT and CHECK-NOT-EMPTY rejected | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5A 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK5C | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5B 2>&1 \ | |
| ; RUN: | FileCheck %s --check-prefix=CHECK5C | |
| CHECK5A-EMPTY-NOT: | |
| CHECK5B-NOT-EMPTY: | |
| CHECK5C: unsupported -NOT combo on prefix 'CHECK5{{A|B}}' | |
| ; whitespace does not count as empty | |
| ; RUN: %ProtectFileCheckOutput \ | |
| ; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK6A --match-full-lines \ | |
| ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK6B | |
| CHECK6A: the next line has spaces | |
| CHECK6A-EMPTY: | |
| CHECK6B: expected string not found in input | |
| ; ***don't add any further blank lines after this point*** | |
| ; CHECK-EMPTY, like CHECK-NEXT, will report an error if the first matching | |
| ; line is not the line immediately following the previous check. | |
| the next line has spaces | |