Package: prysk
Prysk is a fork of the popular snapshot testing toolCram.
Even thoughCramis pretty complete and mature for everyday use,
Prysk wants to continue pushing its development forward.Prysk tests look like snippets of interactive shell sessions. Prysk runs
each command and compares the command output in the test with the
command’s actual output.Here’s a snippet fromPrysk’s own test suite:Set up prysk alias and example tests:$."$TESTDIR"/setup.shUsage:$prysk-h[Uu]sage: prysk \[OPTIONS\] TESTS\.\.\. (re)

  [Oo]ptions: (re)
    -h, --help          show this help message and exit
    -V, --version       show version information and exit
    -q, --quiet         don't print diffs
    -v, --verbose       show filenames and test status
    -i, --interactive   interactively merge changed test output
    -d, --debug         write script output directly to the terminal
    -y, --yes           answer yes to all questions
    -n, --no            answer no to all questions
    -E, --preserve-env  don't reset common environment variables
    --keep-tmpdir       keep temporary directories
    --shell=PATH        shell to use for running tests (default: /bin/sh)
    --shell-opts=OPTS   arguments to invoke shell with
    --indent=NUM        number of spaces to use for indentation (default: 2)
    --xunit-file=PATH   path to write xUnit XML output
    --dos2unix          convert DOS/Windows line endings to UNIX line endings
    --color             mode which shall be used for coloring the outputThe format in a nutshell:Prysk tests use the.tfile extension.Lines beginning with two spaces, a dollar sign ($), and a space are run
in the shell.Lines beginning with two spaces, a greater than sign (>), and a space
allow multi-line commands.All other lines beginning with two spaces are considered command
output.Output lines ending with a space and the keyword(re)are
matched asPerl-compatible regular expressions.Lines ending with a space and the keyword(glob)are matched
with a glob-like syntax. The only special characters supported are*and?. Both characters can be escaped using\, and the
backslash can be escaped itself.Output lines ending with either of the above keywords are always
first matched literally with actual command output.Lines ending with a space and the keyword(no-eol)will match
actual output that doesn’t end in a newline.Actual output lines containing unprintable characters are escaped
and suffixed with a space and the keyword(esc). Lines matching
unprintable output must also contain the keyword.Anything else is a comment.UsagePrysk will print a dot for each passing test. If a test fails, aunified context diffis printed showing the test’s expected output
and the actual output. Skipped tests (empty tests and tests that exit
with return code80) are marked withsinstead of a dot.For example, if we run Prysk onits own example tests:.s.!--- examples/fail.t+++ examples/fail.t.err@@ -3,21 +3,22 @@$ echo 11$ echo 1-  2+  1$ echo 11Invalid regex:$ echo 1-  +++ (re)+  1Offset regular expression:$ printf 'foo\nbar\nbaz\n\n1\nA\n@\n'foo+  barbaz\d (re)[A-Z] (re)-  #+  @s.# Ran 6 tests, 2 skipped, 1 failed.Prysk will also write the test with its actual output toexamples/fail.t.err, allowing you to use other diff tools. This
file is automatically removed the next time the test passes.When you’re first writing a test, you might just write the commands
and run the test to see what happens. If you run Prysk with-ior--interactive, you’ll be prompted to merge the actual output back
into the test. This makes it easy to quickly prototype new tests.Is the same as invoking Prysk with--verboseand--indent=4.Note that the following environment variables are reset before tests
are run:TMPDIR,TEMP, andTMPare set to the test runner’stmpdirectory. In test output, occurrences of this directory are
replaced by$TMPDIR.LANG,LC_ALL, andLANGUAGEare set toC.TZis set toGMT.COLUMNSis set to80. (Note: When using--shell=zsh,
this cannot be reset. It will reflect the actual terminal’s width.)CDPATHandGREP_OPTIONSare set to an empty string.Prysk also provides the following environment variables to tests:PRYSK_TEMP, set to the test runner’s temporary directory.TESTDIR, set to the directory containing the test file.TESTFILE, set to the basename of the current test file.TESTSHELL, set to the value specified by--shell.Also note that care should be taken with commands that close the test
shell’sstdin. For example, if you’re trying to invokesshin
a test, try adding the-noption to prevent it from closingstdin. Similarly, if you invoke a daemon process that inheritsstdoutand fails to close it, it may cause Prysk to hang while
waiting for the test shell’sstdoutto be fully closed.