Category:Jq/assert.jq

From Rosetta Code
Library
This is an example of a library. You may see a list of other libraries used on Rosetta Code at Category:Solutions by Library.

assert.jq is a module which adds support for assertions to the jq programming language.

The following examples assume that the source code has been copied to a file called assert.jq located in the same directory as the importing script so the command line interpreter can find it.

$ jq -nrc --arg assert true -L . 'include "rc-assert"; assert(. == false; $__loc__)'
jq: error (at <unknown>): assertion violation @ <top-level>:1 => false
$ jq -nrc --arg assert debug -L. 'include "rc-assert"; assert(. == false; $__loc__)'
["DEBUG:","assertion violation @ <top-level>:1 => false"]
null

Pages in category "Jq/assert.jq"

This category contains only the following page.