Skip to content

Commit

Permalink
Merge pull request #85 from stanislaw/develop
Browse files Browse the repository at this point in the history
docs: Check commands: CHECK-NEXT description
  • Loading branch information
stanislaw authored Dec 29, 2019
2 parents 1d3ff97 + 0233cb8 commit 1a90408
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 36 additions & 1 deletion docs/05-check-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,42 @@ Example
CHECK-NEXT
----------

...
``CHECK-NEXT`` command means that a given string or a regular expression must be
present in input provided to FileCheck. Additionally, there must be another
check right before ``CHECK-NEXT``, that has passed on the input line just before
the current input line. ``CHECK-NEXT`` cannot be the first check in the check
file.

Check file ``CHECK-NEXT.check``:

.. code-block:: text
CHECK: String1
CHECK-NEXT: String2
.. code-block:: bash
$ echo -e "String1\nString2" | filecheck CHECK-NEXT.check
...filecheck
$ echo ?0
0
.. code-block:: bash
$ echo -e "String1\nfoo\nString2" | filecheck CHECK-NEXT.check
...filecheck
CHECK-NEXT.check:2:13: error: CHECK-NEXT: is not on the line after the previous match
CHECK-NEXT: String2
^
<stdin>:3:1: note: 'next' match was here
String2
^
<stdin>:1:8: note: previous match ended here
String1
^
<stdin>:2:1: note: non-matching line after previous match is here
foo
^
CHECK-EMPTY
-----------
Expand Down
2 changes: 2 additions & 0 deletions examples/check-commands/CHECK-NEXT.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CHECK: String1
CHECK-NEXT: String2

0 comments on commit 1a90408

Please sign in to comment.