testecho is a program to assist test cases which assert the subject starts and ends processes as expected. Its flags allow selection of stdout, stderr, exit code, etc.
The testecho package provides functions to more easily run the CLI from test cases.
To install:
go get -v github.com/codeactual/testecho/cmd/testecho
Display help
testecho --help
Print "out" to standard output:
testecho --stdout out
Same as above but also print "err" to standard error:
testecho --stdout out --stderr err
Same as above but also exit with code 7 instead of 0:
testecho --stdout out --stderr err --code 7
Same as above but also sleep for 5 seconds after printing:
testecho --stdout out --stderr err --code 7 --sleep 5
Spawn another testecho proecss, print its PID, and then sleep "forever" (10000 seconds):
testecho --spawn
Same as above but also print "err" to standard error:
testecho --spawn --stderr err
Print standard input:
echo "out" | testecho
Same as above but also print "err" to standard error:
echo "out" | testecho --stderr err
Same as above but also exit with code 7 instead of 0:
echo "out" | testecho --stderr err --code 7
Same as above but also sleep for 5 seconds after printing
echo "out" | testecho --stderr err --code 7 --sleep 5
Mozilla Public License Version 2.0 (About, FAQ)
- Please feel free to submit issues, PRs, questions, and feedback.
- Although this repository consists of snapshots extracted from a private monorepo using transplant, PRs are welcome. Standard GitHub workflows are still used.