LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

clitest

Doctest-style automatic testing for Unix command lines

TLDR

Run tests from a file
$ clitest [examples/intro.txt]
copy
Show help
$ clitest --help
copy
Run via Docker
$ docker run --rm -t aureliojargas/clitest [tests.txt]
copy

SYNOPSIS

clitest [*options*] *testfile*...

DESCRIPTION

clitest is a portable POSIX shell script that tests Unix command lines the way Python doctest tests interactive sessions. You write a text file that looks like a shell transcript ($ prompts, commands, expected stdout). clitest executes each command and checks that the output matches exactly.No special DSL: test files use familiar CLI syntax. Useful for documenting and regression-testing shell tools and tutorials.Install by downloading the script, chmod +x, and placing it on PATH, or use the Docker image aureliojargas/clitest.

PARAMETERS

*testfile*

Path to one or more test transcript files.
See clitest --help for flags (progress, prefixes, environment, and failure behaviour vary by version).

EXAMPLE TEST FILE

$ $ echo "Hello World"
Hello World
$ cd /tmp
$ pwd
/tmp
copy

INSTALL

sudo dnf install clitest
copy
sudo pacman -S clitest
copy
brew install clitest
copy

CAVEATS

Output must match exactly (whitespace and locale matter). Commands run for real with your shell environment; avoid destructive examples. Interactive programs and TUI apps are a poor fit. Portable sh, but individual tests may assume Linux utilities.

SEE ALSO

bats(1), shunit2(1), expect(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid