Skip Navigation

olets/zsh-test-runner: Straight-forward tests and coverage reports for Zsh (and emulated csh, ksh, sh)

github.com GitHub - olets/zsh-test-runner: Straight-forward tests and coverage reports for zsh and —under zsh's emulation— csh, ksh, and sh

Straight-forward tests and coverage reports for zsh and —under zsh's emulation— csh, ksh, and sh - GitHub - olets/zsh-test-runner: Straight-forward tests and coverage reports for zsh and —under...

GitHub - olets/zsh-test-runner: Straight-forward tests and coverage reports for zsh and —under zsh's emulation— csh, ksh, and sh

This is not my work, but the author (same author as zsh-abbr) posted it elsewhere and it looks good to me.

In his words:

What is zsh-test-runner? A simple testing framework for zsh, and to a degree —thanks to zsh's emulation of other shells— csh, ksh, and sh.

The immediately noticeable difference between zsh-test-runner and other shell script unit test frameworks is it doesn't have a DSL. zsh-test-runner relies entirely on the shell's own testing. For those familiar with other frameworks: nothing like ShellSpec's Describe … When call … The output should, or shUnit2's assertEquals, or ZUnit's assert; zsh-test-runner is closer to Bats if you were to restrict yourself to core and not use helper libraries (there's nothing like bats-assert's assertEquals or bats-file's assert_dir_exists).

Why no special syntax? It means there's little new to learn— For example, if you know how to test numeric equality in your shell, you know how to test equality in zsh-test-runner; if you don't, there are community resources available. It means every possible test is supported equally out of the box— zsh-test-runner is a newcomer, but there are no "shoot my assertion method isn't supported" blockers. It means the cost of porting homegrow framework-less tests to zsh-test-runner is about as low as can be— generally speaking, my_cool_test_code becomes ztr test 'my_cool_test_code'. It means tests can live comfortably in one LOC, making zsh-test-runner pleasant to use in the terminal.

0
0 comments