html tool

2017年3月6日星期一

bash unittest

bash unittest
https://github.com/sstephenson/bats/tree/revert-90-master

install:
$ git clone https://github.com/sstephenson/bats.git
$ cd bats
$ ./install.sh /usr/local (Note that you may need to run install.sh with sudo if you do not have permission to write to the installation prefix.)

test:
$cd test
$ bats bats.bats
 ✓ no arguments prints usage instructions
 ✓ -v and --version print version number
 ✓ -h and --help print help
 ✓ invalid filename prints an error
 ✓ empty test file runs zero tests
 ✓ one passing test
 ✓ summary passing tests
 ✓ summary passing and skipping tests
 ✓ summary passing and failing tests
 ✓ summary passing, failing and skipping tests
 ✓ one failing test
 ✓ one failing and one passing test
 ✓ failing test with significant status
 ✓ failing helper function logs the test case's line number
 ✓ test environments are isolated
 ✓ setup is run once before each test
 ✓ teardown is run once after each test, even if it fails
 ✓ setup failure
 ✓ passing test with teardown failure
 ✓ failing test with teardown failure
 ✓ teardown failure with significant status
 ✓ failing test file outside of BATS_CWD
 ✓ load sources scripts relative to the current test file
 ✓ load aborts if the specified script does not exist
 ✓ load sources scripts by absolute path
 ✓ load aborts if the script, specified by an absolute path, does not exist
 ✓ output is discarded for passing tests and printed for failing tests
 ✓ -c prints the number of tests
 ✓ dash-e is not mangled on beginning of line
 ✓ dos line endings are stripped before testing
 ✓ test file without trailing newline
 ✓ skipped tests
 ✓ extended syntax
 ✓ pretty and tap formats
 ✓ pretty formatter bails on invalid tap
 ✓ single-line tests
 ✓ testing IFS not modified by run

37 tests, 0 failures

没有评论:

发表评论