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-NEXT description #85

Merged
merged 1 commit into from
Dec 29, 2019
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
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