Skip to content

Commit

Permalink
Merge pull request #91 from stanislaw/develop
Browse files Browse the repository at this point in the history
docs: check commands: CHECK-EMPTY: initial description
  • Loading branch information
stanislaw authored Jan 26, 2020
2 parents 726c6a7 + 3bd4774 commit 1617faa
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
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:

0 comments on commit 1617faa

Please sign in to comment.