diff --git a/doc/shunit2.html b/doc/shunit2.html index 4285223..14edde8 100644 --- a/doc/shunit2.html +++ b/doc/shunit2.html @@ -598,11 +598,13 @@

Setup/Teardown

This function can be be optionally overridden by the user in their test suite.

If this function exists, it will be called before each test is run. It is useful to reset the environment before each test.

+

This function accepts one argument - name of the test that will be executed right after setUp().

tearDown

This function can be be optionally overridden by the user in their test suite.

If this function exists, it will be called after each test completes. It is useful to clean up the environment after each test.

+

This function accepts one argument - name of the test that has been executed right before this tearDown().

diff --git a/doc/shunit2.txt b/doc/shunit2.txt index 537e2eb..d3403ea 100644 --- a/doc/shunit2.txt +++ b/doc/shunit2.txt @@ -290,12 +290,18 @@ Setup/Teardown If this function exists, it will be called before each test is run. It is useful to reset the environment before each test. + This function accepts one argument - name of the test that will be executed +right after setUp(). + ``tearDown`` This function can be be optionally overridden by the user in their test suite. If this function exists, it will be called after each test completes. It is useful to clean up the environment after each test. + This function accepts one argument - name of the test that has been executed +right before this tearDown(). + Skipping -------- diff --git a/shunit2 b/shunit2 index d9bbd1c..7f40f91 100755 --- a/shunit2 +++ b/shunit2 @@ -715,7 +715,7 @@ suite_addTest() { # Note: see _shunit_mktempFunc() for actual implementation # # Args: -# None +# testName Name of the test that will be executed after this setUp #setUp() { :; } # DO NOT UNCOMMENT THIS FUNCTION # Note: see _shunit_mktempFunc() for actual implementation @@ -727,7 +727,7 @@ suite_addTest() { # Note: see _shunit_mktempFunc() for actual implementation # # Args: -# None +# testName Name of the test after which this tearDown is executed #tearDown() { :; } # DO NOT UNCOMMENT THIS FUNCTION #------------------------------------------------------------------------------ @@ -879,14 +879,14 @@ _shunit_execSuite() { endSkipping # Execute the per-test setup function. - setUp + setUp "${_shunit_test_}" # Execute the test. echo "${__SHUNIT_TEST_PREFIX}${_shunit_test_}" eval "${_shunit_test_}" # Execute the per-test tear-down function. - tearDown + tearDown "${_shunit_test_}" # Update stats. if \[ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then