Skip to content

urs/bash-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bash-test

Build Status Code Climate Issue Count

Simple test runner for Bash.

Installation

Just download the file (preferably somewhere in your $PATH) and give it execution permissions:

$ curl https://git.io/bash-test > /usr/local/bin/bash-test &&\
  chmod +x /usr/local/bin/bash-test

Usage

Write test cases as Shell Functions, starting with test_ and export the variable SOURCE with the relative path to the directory where your scripts are located.

Example:

#!/usr/bin/env bash

export SOURCE='../src'

test_something() {
  echo "foo" | grep "bar"
}

test_something_else() {
  test 2 -eq 2
}

test_my_script() {
  test $(my-script 'some input') -eq 'some output'
}

To run the tests, simply:

$ bash-test path/to/tests.sh
bash-test v0.1.0 by Campanda GmbH and contributors.

tests.sh
  ✓ test_my_script
  ✗ test_something
  ✓ test_something_else

 1 of 3 tests failed.

License

bash-test is released under the MIT License.

About

Simple test runner for Bash.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%