diff options
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-x | t/t0000-basic.sh | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 3ec9cbef2c..f688bd3ef5 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -54,9 +54,40 @@ test_expect_success 'success is reported like this' ' test_expect_failure 'pretend we have a known breakage' ' false ' + +test_expect_success 'pretend we have fixed a known breakage (run in sub test-lib)' " + mkdir passing-todo && + (cd passing-todo && + cat >passing-todo.sh <<EOF && +#!$SHELL_PATH + +test_description='A passing TODO test + +This is run in a sub test-lib so that we do not get incorrect passing +metrics +' + +# Point to the t/test-lib.sh, which isn't in ../ as usual +TEST_DIRECTORY=\"$TEST_DIRECTORY\" +. \"\$TEST_DIRECTORY\"/test-lib.sh + test_expect_failure 'pretend we have fixed a known breakage' ' : ' + +test_done +EOF + chmod +x passing-todo.sh && + ./passing-todo.sh >out 2>err && + ! test -s err && +cat >expect <<EOF && +ok 1 - pretend we have fixed a known breakage # TODO known breakage +# fixed 1 known breakage(s) +# passed all 1 test(s) +1..1 +EOF + test_cmp expect out) +" test_set_prereq HAVEIT haveit=no test_expect_success HAVEIT 'test runs if prerequisite is satisfied' ' @@ -73,6 +104,27 @@ then exit 1 fi +test_set_prereq HAVETHIS +haveit=no +test_expect_success HAVETHIS,HAVEIT 'test runs if prerequisites are satisfied' ' + test_have_prereq HAVEIT && + test_have_prereq HAVETHIS && + haveit=yes +' +donthaveit=yes +test_expect_success HAVEIT,DONTHAVEIT 'unmet prerequisites causes test to be skipped' ' + donthaveit=no +' +donthaveiteither=yes +test_expect_success DONTHAVEIT,HAVEIT 'unmet prerequisites causes test to be skipped' ' + donthaveiteither=no +' +if test $haveit$donthaveit$donthaveiteither != yesyesyes +then + say "bug in test framework: multiple prerequisite tags do not work reliably" + exit 1 +fi + clean=no test_expect_success 'tests clean up after themselves' ' test_when_finished clean=yes @@ -301,7 +353,7 @@ $expectfilter >expected <<\EOF EOF test_expect_success \ 'validate git diff-files output for a know cache/work tree state.' \ - 'git diff-files >current && diff >/dev/null -b current expected' + 'git diff-files >current && test_cmp current expected >/dev/null' test_expect_success \ 'git update-index --refresh should succeed.' \ |