Skip to content
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
27 changes: 0 additions & 27 deletions docs/03-tutorial-hello-world.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,6 @@ With invalid input:
$ echo $?
1

Order of matching
-----------------

CHECK commands are checked one after another. If a CHECK string is not found in
output, FileCheck exits with an error.

Create a new file ``order-of-matching.check`` with the following contents:

.. code-block:: text

CHECK: String1
CHECK: String2
CHECK: String3

And run with invalid input:

.. code-block:: text

echo "String1" | filecheck order-of-matching.check
...
order-of-matching.check:2:8: error: CHECK: expected string not found in input
CHECK: String2
^
<stdin>:1:8: note: scanning from here
String1
^

What's next?
------------

Expand Down
57 changes: 54 additions & 3 deletions docs/05-check-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ For all of the examples below, please note:
CHECK
-----

``CHECK`` command simply means something has to be in input given to FileCheck.
``CHECK`` command means that a given string or a regular expression must be
present in input provided to FileCheck.

Create a new file ``CHECK.check`` with the following contents:

Expand All @@ -39,7 +40,7 @@ Invalid input results in the exit code ``1`` and error message:

.. code-block:: bash

echo -e "String1" | filecheck CHECK.check
echo "String1" | filecheck CHECK.check
/Users/Stanislaw/.pyenv/versions/3.5.0/bin/filecheck
CHECK.check:2:8: error: CHECK: expected string not found in input
CHECK: String2
Expand All @@ -48,10 +49,60 @@ Invalid input results in the exit code ``1`` and error message:
String1
^

Order of matching
~~~~~~~~~~~~~~~~~

CHECK commands are checked one after another. If a CHECK string is not found in
output, FileCheck exits with error immediately.

Create a new file ``order-of-matching.check`` with the following contents:

.. code-block:: text

CHECK: String1
CHECK: String2
CHECK: String3

And run with invalid input:

.. code-block:: text

echo "String1" | filecheck order-of-matching.check
...
order-of-matching.check:2:8: error: CHECK: expected string not found in input
CHECK: String2
^
<stdin>:1:8: note: scanning from here
String1
^

CHECK-NOT
---------

...
``CHECK-NOT`` is the opposite of ``CHECK``: a given string or a regular
expression must not be present in input provided to FileCheck.

Example
~~~~~~~

``CHECK-NOT.check`` file:

.. code-block:: text

CHECK-NOT: String1
CHECK-NOT: String2
CHECK-NOT: String3

.. code-block:: bash

$ echo "String3" | filecheck CHECK-NOT.check
filecheck
CHECK-NOT.check:3:12: error: CHECK-NOT: excluded string found in input
CHECK-NOT: String3
^
<stdin>:1:1: note: found here
String3
^~~~~~~

CHECK-NEXT
----------
Expand Down
4 changes: 4 additions & 0 deletions examples/check-commands/CHECK-NOT.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CHECK-NOT: String1
CHECK-NOT: String2
CHECK-NOT: String3