Skip to content

ingydotnet/test-simple-bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test-simple(1)

NAME

test-simple - Simple TAP test framework for Bash

SYNOPSIS

In a file, say, test/my_test.t:

source test-simple.bash tests 5
ok 0                    '0 is true (other numbers are false)'
answer=$(question "...?")
ok [ $answer == yes ]   'The answer is yes!'
ok [[ $answer =~ ^y ]]  'The answer begins with y'
ok true                 'true is ok'
ok '! false'            '! false is true'

Run the tests:

prove -ebash -v test/

DESCRIPTION

The test-simple library is meant to work for Bash, just like the Test::Simple module does in Perl.

You can run the tests under any TAP harness tool. The prove utility is the most popular one.

The library provides one function called ok():

ok <testing> <arguments> [<label>]

The last argument is assumed to be the a label, unless there is only one argument, or unless its value is ] or ]].

The test arguments are evaled and if the result is true, the test passes, otherwise it fails.

INSTALLATION

Just run:

make install

Possibly with sudo. The default location to install is /usr/local/lib/bash (assuming you are using /bin/bash). To override the installation location, do something like this:

INSTALL_DIR=/your/bash/lib/path make -e install

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published