Code clean-up.
* jk/t0000-cleanups:
t0000: consistently use single quotes for outer tests
t0000: run cleaning test inside sub-test
t0000: run prereq tests inside sub-test
t0000: keep clean-up tests together
test_expect_success 'pretend we have a partially passing test suite' "
test_expect_success 'pretend we have a partially passing test suite' '
run_sub_test_lib_test_err \
partial-pass '2/3 tests passing' <<-\\EOF &&
test_expect_success 'passing test #1' 'true'
test_expect_success 'failing test #2' 'false'
test_expect_success 'passing test #3' 'true'
partial-pass "2/3 tests passing" <<-\EOF &&
test_expect_success "passing test #1" "true"
test_expect_success "failing test #2" "false"
test_expect_success "passing test #3" "true"
test_done
EOF
check_sub_test_lib_test partial-pass <<-\\EOF
check_sub_test_lib_test partial-pass <<-\EOF
> ok 1 - passing test #1
> not ok 2 - failing test #2
# false
@ -168,44 +168,44 @@ test_expect_success 'pretend we have a partially passing test suite' "
@@ -168,44 +168,44 @@ test_expect_success 'pretend we have a partially passing test suite' "
> # failed 1 among 3 test(s)
> 1..3
EOF
"
'
test_expect_success 'pretend we have a known breakage' "
run_sub_test_lib_test failing-todo 'A failing TODO test' <<-\\EOF &&
test_expect_success 'passing test' 'true'
test_expect_failure 'pretend we have a known breakage' 'false'
test_expect_success 'pretend we have a known breakage' '
run_sub_test_lib_test failing-todo "A failing TODO test" <<-\EOF &&
test_expect_success "passing test" "true"
test_expect_failure "pretend we have a known breakage" "false"
test_done
EOF
check_sub_test_lib_test failing-todo <<-\\EOF
check_sub_test_lib_test failing-todo <<-\EOF
> ok 1 - passing test
> not ok 2 - pretend we have a known breakage # TODO known breakage
> # still have 1 known breakage(s)
> # passed all remaining 1 test(s)
> 1..2
EOF
"
'
test_expect_success 'pretend we have fixed a known breakage' "
run_sub_test_lib_test passing-todo 'A passing TODO test' <<-\\EOF &&
test_expect_failure 'pretend we have fixed a known breakage' 'true'
test_expect_success 'pretend we have fixed a known breakage' '
run_sub_test_lib_test passing-todo "A passing TODO test" <<-\EOF &&
test_expect_failure "pretend we have fixed a known breakage" "true"
test_done
EOF
check_sub_test_lib_test passing-todo <<-\\EOF
check_sub_test_lib_test passing-todo <<-\EOF
> ok 1 - pretend we have fixed a known breakage # TODO known breakage vanished
> # 1 known breakage(s) vanished; please update test(s)
> 1..1
EOF
"
'
test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' "
test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' '
run_sub_test_lib_test partially-passing-todos \
'2 TODO tests, one passing' <<-\\EOF &&
test_expect_failure 'pretend we have a known breakage' 'false'
test_expect_success 'pretend we have a passing test' 'true'
test_expect_failure 'pretend we have fixed another known breakage' 'true'
"2 TODO tests, one passing" <<-\EOF &&
test_expect_failure "pretend we have a known breakage" "false"
test_expect_success "pretend we have a passing test" "true"
test_expect_failure "pretend we have fixed another known breakage" "true"
> not ok 1 - pretend we have a known breakage # TODO known breakage
> ok 2 - pretend we have a passing test
> ok 3 - pretend we have fixed another known breakage # TODO known breakage vanished
@ -214,17 +214,17 @@ test_expect_success 'pretend we have fixed one of two known breakages (run in su
@@ -214,17 +214,17 @@ test_expect_success 'pretend we have fixed one of two known breakages (run in su
> # passed all remaining 1 test(s)
> 1..3
EOF
"
'
test_expect_success 'pretend we have a pass, fail, and known breakage' "
test_expect_success 'pretend we have a pass, fail, and known breakage' '
run_sub_test_lib_test_err \
mixed-results1 'mixed results #1' <<-\\EOF &&
test_expect_success 'passing test' 'true'
test_expect_success 'failing test' 'false'
test_expect_failure 'pretend we have a known breakage' 'false'
mixed-results1 "mixed results #1" <<-\EOF &&
test_expect_success "passing test" "true"
test_expect_success "failing test" "false"
test_expect_failure "pretend we have a known breakage" "false"
test_done
EOF
check_sub_test_lib_test mixed-results1 <<-\\EOF
check_sub_test_lib_test mixed-results1 <<-\EOF
> ok 1 - passing test
> not ok 2 - failing test
> # false
@ -233,24 +233,24 @@ test_expect_success 'pretend we have a pass, fail, and known breakage' "
@@ -233,24 +233,24 @@ test_expect_success 'pretend we have a pass, fail, and known breakage' "
> # failed 1 among remaining 2 test(s)
> 1..3
EOF
"
'
test_expect_success 'pretend we have a mix of all possible results' "
test_expect_success 'pretend we have a mix of all possible results' '
run_sub_test_lib_test_err \
mixed-results2 'mixed results #2' <<-\\EOF &&
test_expect_success 'passing test' 'true'
test_expect_success 'passing test' 'true'
test_expect_success 'passing test' 'true'
test_expect_success 'passing test' 'true'
test_expect_success 'failing test' 'false'
test_expect_success 'failing test' 'false'
test_expect_success 'failing test' 'false'
test_expect_failure 'pretend we have a known breakage' 'false'
test_expect_failure 'pretend we have a known breakage' 'false'
test_expect_failure 'pretend we have fixed a known breakage' 'true'
mixed-results2 "mixed results #2" <<-\EOF &&
test_expect_success "passing test" "true"
test_expect_success "passing test" "true"
test_expect_success "passing test" "true"
test_expect_success "passing test" "true"
test_expect_success "failing test" "false"
test_expect_success "failing test" "false"
test_expect_success "failing test" "false"
test_expect_failure "pretend we have a known breakage" "false"
test_expect_failure "pretend we have a known breakage" "false"
test_expect_failure "pretend we have fixed a known breakage" "true"
test_done
EOF
check_sub_test_lib_test mixed-results2 <<-\\EOF
check_sub_test_lib_test mixed-results2 <<-\EOF
> ok 1 - passing test
> ok 2 - passing test
> ok 3 - passing test
@ -269,7 +269,7 @@ test_expect_success 'pretend we have a mix of all possible results' "
@@ -269,7 +269,7 @@ test_expect_success 'pretend we have a mix of all possible results' "
test_expect_success 'tests clean up after themselves' '
run_sub_test_lib_test cleanup "test with cleanup" <<-\EOF &&
clean=no
test_expect_success "do cleanup" "
test_when_finished clean=yes
"
test_expect_success "cleanup happened" "
test $clean = yes
"
test_done
EOF
grep 'echo trace' lazy-prereq-and-tracing/err
"
check_sub_test_lib_test cleanup <<-\EOF
ok 1 - do cleanup
ok 2 - cleanup happened
# passed all 2 test(s)
1..2
EOF
'
test_expect_success 'tests clean up even on failures' "
test_expect_success 'tests clean up even on failures' '
run_sub_test_lib_test_err \
failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
test_expect_success 'tests clean up even after a failure' '
failing-cleanup "Failing tests with cleanup commands" <<-\EOF &&
test_expect_success "tests clean up even after a failure" "
touch clean-after-failure &&
test_when_finished rm clean-after-failure &&
(exit 1)
'
test_expect_success 'failure to clean up causes the test to fail' '
"
test_expect_success "failure to clean up causes the test to fail" "
test_when_finished \"(exit 2)\"
'
"
test_done
EOF
check_sub_test_lib_test failing-cleanup <<-\\EOF
check_sub_test_lib_test failing-cleanup <<-\EOF
> not ok 1 - tests clean up even after a failure
> # Z
> # touch clean-after-failure &&
@ -896,30 +894,30 @@ test_expect_success 'tests clean up even on failures' "
@@ -896,30 +894,30 @@ test_expect_success 'tests clean up even on failures' "
> # Z
> not ok 2 - failure to clean up causes the test to fail