Note: only tested with bash.
This is a minimal Approval-Tests utility for the cli.
BTW, ChatGPT helped to get things started.
Given a command <test-command>
that produces some output to verify, use the verify.sh
script like this:
<test-command> | ./verify.sh -t <test-name> [-d <diff-tool>]
If the result of <test-command>
differs from the approved result, the <diff-tool>
will be triggered.
Simplest form
echo "hello world!" | ./verify.sh -t hello-world
Specify a different diff tool
echo "hello diff tool" | ./verify.sh -t hello-diff -d "git diff --no-index"
(yes, verify.sh
is used to test itself)
(cd bash && ./test.sh | ./verify.sh -t verify-cli-bash)