Skip to content

cmayo/bashunit

 
 

Repository files navigation

Tests Static analysis Docs deployment Editorconfig checker MIT Software License


bashunit

A simple testing library for bash scripts

Test your bash scripts in the fastest and simplest way, discover the most modern bash testing library.

Usage

./bashunit <test_script>

Example: Defining your own tests

# example/logic.sh

echo "expected $1"
# example/logic_test.sh

SCRIPT="./logic.sh"

function test_your_logic() {
    assertEquals "expected 123" "$($SCRIPT "123")"
}

Check out the example directory for more.

Installation

Although there's no Bash script dependency manager like npm for JavaScript, Maven for Java, pip for Python, or composer for PHP; you can install this project in your repository according to your preferences. Here, I provide a Git submodule option that will work for you.

Git submodule

You can use Git submodules to include external Git repositories within your project. This approach works well for including Bash scripts or other resources from remote repositories.

git submodule add git@github.com:TypedDevs/bashunit.git tools/bashunit

Versioning and updates

To update a git-submodule:

  1. keep the git-submodule under your git (committed)
  2. go inside the git-submodule and:
    1. git submodule update --remote (preferred)
    2. or pull main
    3. or checkout a concrete release tag

Contribute

You are welcome to contribute reporting issues, sharing ideas, or with your Pull Requests.

Contributors

Contributors list

About

A simple testing library for bash scripts.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 92.6%
  • Makefile 7.4%