From: lacton <la...@us...> - 2008-03-24 12:56:32
|
Update of /cvsroot/shunit/ShUnit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6996 Modified Files: autoSuiteTest shUnitTest Added Files: bashUnitAcceptanceTest Removed Files: shuStartWithMoreThanOneArgumentTest Log Message: [refactor] Added high-level acceptance tests. Added bashUnitAcceptanceTest for bash-specific high-level features. Moved tests that were more like acceptance tests than unit tests from shUnitTest to shUnitAcceptanceTest. Simplified autoSuiteTest now that it is called by bashUnitAcceptanceTest. Index: shUnitTest =================================================================== RCS file: /cvsroot/shunit/ShUnit/shUnitTest,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** shUnitTest 22 Mar 2008 10:19:47 -0000 1.21 --- shUnitTest 24 Mar 2008 12:56:27 -0000 1.22 *************** *** 154,178 **** } - TestAutoSuite() { - std_output=`./autoSuiteTest` - echo "$std_output" | grep -q 'NotATest' - shuDeny "Auto-detected suite should not include NotATest" $? - echo "$std_output" | grep -q 'Test1' - shuAssert "Auto-detected suite should include Test1" $? - } - - TestShuStartCalledWithMoreThanOneArgument() { - stdout=`./shuStartWithMoreThanOneArgumentTest 2>/dev/null` - stderr=`./shuStartWithMoreThanOneArgumentTest 2>&1 >/dev/null` - - shuDeny "Exit code should be KO" $? - - test "" = "$stdout" - shuAssert "Standard output should be empty" $? - - test "shuStart: invalid number of arguments -- 2" = "$stderr" - shuAssert "Error message" $? - } - InitFunction() { shuRegTest TestIntentionalFailure --- 154,157 ---- *************** *** 186,191 **** shuRegTest TestOneAssertFailureAndOneAssertSuccessMeanFailure shuRegTest TestOneDenyFailureAndOneDenySuccessMeanFailure - shuRegTest TestAutoSuite - shuRegTest TestShuStartCalledWithMoreThanOneArgument } --- 165,168 ---- *************** *** 194,196 **** shuStart InitFunction - --- 171,172 ---- --- NEW FILE: bashUnitAcceptanceTest --- #! /usr/bin/env bash # # Acceptance tests for ShUnit that should work with bash, but may not work with other Bourne derived shells. # A failing test here should be considered a defect only if it fails with bash. # # # Test Cases # Suite() { shuRegTest TestAutoSuite } TestAutoSuite() { stdout=`$SHUNIT_HOME/autoSuiteTest` shuAssert "Expected successful exit code" $? echo "$stdout" | grep -q 'Test1' shuAssert "Expected 'Test1'" $? echo "$stdout" | grep -q 'NotATest' shuDeny "Expected 'NotATest' to be ignored" $? } # # Support Functions # # # Main # . "$SHUNIT_HOME/shUnit" shuStart Suite Index: autoSuiteTest =================================================================== RCS file: /cvsroot/shunit/ShUnit/autoSuiteTest,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** autoSuiteTest 17 Mar 2008 06:42:55 -0000 1.3 --- autoSuiteTest 24 Mar 2008 12:56:27 -0000 1.4 *************** *** 1,19 **** - #! /usr/bin/env sh - # # This dummy test script illustrates how to use the test suite auto-detection features. ! # It is called by shUnitTest as part of the framework's regression test. ! # ! ! # ! # find the shUnit file using the command as a reference # - inherit() { - d=`expr ${0} : '\([a-zA-Z/._-]*\/\)'` - test `expr "$d" : '[./]'` -eq 0 && d="./$d" - . ${d}${1} - } - - inherit shUnit NotATest() { --- 1,6 ---- # # This dummy test script illustrates how to use the test suite auto-detection features. ! # It is called as part of the framework's acceptance tests. # NotATest() { *************** *** 27,29 **** --- 14,17 ---- ### Main + . "$SHUNIT_HOME/shUnit" shuStart \ No newline at end of file --- shuStartWithMoreThanOneArgumentTest DELETED --- |