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

docs: check commands: CHECK-EMPTY: initial description #91

Merged
merged 1 commit into from
Jan 26, 2020
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
34 changes: 32 additions & 2 deletions docs/05-check-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Check file ``CHECK-NEXT.check``:

$ echo -e "String1\nString2" | filecheck CHECK-NEXT.check
...filecheck
$ echo ?0
$ echo $?
0

.. code-block:: bash
Expand All @@ -145,4 +145,34 @@ Check file ``CHECK-NEXT.check``:
CHECK-EMPTY
-----------

...
``CHECK-EMPTY`` command is used to match empty lines.

Consider the following check file:

.. code-block:: text

CHECK: String1
CHECK-EMPTY:
CHECK: String2

In the following example, there is an empty line so the test will pass:

.. code-block:: bash

echo -e "String1\n\nString2" | filecheck CHECK-EMPTY.check
...filecheck
$ echo $?
0

If the empty line is removed, the test will fail:

echo -e "String1\nString2" | filecheck CHECK-EMPTY.check
...filecheck
...CHECK-EMPTY.check:2:13: error: CHECK-EMPTY: expected string not found in input
CHECK-EMPTY:
^
<stdin>:2:1: note: scanning from here
String2
^
$ echo $?
1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CHECK: String1
CHECK-EMPTY:
CHECK: String2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; RUN: echo -e "String1\nString2" | (%FILECHECK_EXEC %S/CHECK-EMPTY.check 2>&1; test $? = 1) | %FILECHECK_EXEC %s
; CHECK: {{^.*}}FileCheck{{(\.py)?$}}
; CHECK: {{^.*}}CHECK-EMPTY.check:2:13: error: CHECK-EMPTY: expected string not found in input
; CHECK: CHECK-EMPTY:
; CHECK: ^
; CHECK: <stdin>:2:1: note: scanning from here
; CHECK: String2
; CHECK: ^
; CHECK-EMPTY:
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CHECK: String1
CHECK-EMPTY:
CHECK: String2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; RUN: echo -e "String1\n\nString2" | %FILECHECK_EXEC %S/CHECK-EMPTY.check | %FILECHECK_EXEC %s
; CHECK: {{^.*}}FileCheck{{(\.py)?$}}
; CHECK-EMPTY: