68
'
69
70
test_expect_success 'pretend we have a fully passing test suite' '
71
- run_sub_test_lib_test full-pass "3 passing tests" <<-\EOF &&
71
+ write_and_run_sub_test_lib_test full-pass "3 passing tests" <<-\EOF &&
72
for i in 1 2 3
73
do
74
test_expect_success "passing test #$i" "true"
85
'
86
87
test_expect_success 'pretend we have a partially passing test suite' '
88
- run_sub_test_lib_test_err \
88
+ write_and_run_sub_test_lib_test_err \
89
partial-pass "2/3 tests passing" <<-\EOF &&
90
test_expect_success "passing test #1" "true"
91
test_expect_success "failing test #2" "false"
103
'
104
105
test_expect_success 'pretend we have a known breakage' '
106
- run_sub_test_lib_test failing-todo "A failing TODO test" <<-\EOF &&
106
+ write_and_run_sub_test_lib_test failing-todo "A failing TODO test" <<-\EOF &&
107
test_expect_success "passing test" "true"
108
test_expect_failure "pretend we have a known breakage" "false"
109
test_done
118
'
119
120
test_expect_success 'pretend we have fixed a known breakage' '
121
- run_sub_test_lib_test passing-todo "A passing TODO test" <<-\EOF &&
121
+ write_and_run_sub_test_lib_test passing-todo "A passing TODO test" <<-\EOF &&
122
test_expect_failure "pretend we have fixed a known breakage" "true"
123
test_done
124
EOF
130
'
131
132
test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' '
133
- run_sub_test_lib_test partially-passing-todos \
133
+ write_and_run_sub_test_lib_test partially-passing-todos \
134
"2 TODO tests, one passing" <<-\EOF &&
135
test_expect_failure "pretend we have a known breakage" "false"
136
test_expect_success "pretend we have a passing test" "true"
149
'
150
151
test_expect_success 'pretend we have a pass, fail, and known breakage' '
152
- run_sub_test_lib_test_err \
152
+ write_and_run_sub_test_lib_test_err \
153
mixed-results1 "mixed results #1" <<-\EOF &&
154
test_expect_success "passing test" "true"
155
test_expect_success "failing test" "false"
168
'
169
170
test_expect_success 'pretend we have a mix of all possible results' '
171
- run_sub_test_lib_test_err \
171
+ write_and_run_sub_test_lib_test_err \
172
mixed-results2 "mixed results #2" <<-\EOF &&
173
test_expect_success "passing test" "true"
174
test_expect_success "passing test" "true"
204
'
205
206
test_expect_success 'test --verbose' '
207
- run_sub_test_lib_test_err \
207
+ write_and_run_sub_test_lib_test_err \
208
t1234-verbose "test verbose" --verbose <<-\EOF &&
209
test_expect_success "passing test" true
210
test_expect_success "test with output" "echo foo"
231
'
232
233
test_expect_success 'test --verbose-only' '
234
- run_sub_test_lib_test_err \
234
+ write_and_run_sub_test_lib_test_err \
235
t2345-verbose-only-2 "test verbose-only=2" \
236
--verbose-only=2 <<-\EOF &&
237
test_expect_success "passing test" true
255
256
test_expect_success 'GIT_SKIP_TESTS' '
257
(
258
- run_sub_test_lib_test git-skip-tests-basic \
258
+ write_and_run_sub_test_lib_test git-skip-tests-basic \
259
"GIT_SKIP_TESTS" \
260
--skip="git.2" <<-\EOF &&
261
for i in 1 2 3
276
277
test_expect_success 'GIT_SKIP_TESTS several tests' '
278
(
279
- run_sub_test_lib_test git-skip-tests-several \
279
+ write_and_run_sub_test_lib_test git-skip-tests-several \
280
"GIT_SKIP_TESTS several tests" \
281
--skip="git.2 git.5" <<-\EOF &&
282
for i in 1 2 3 4 5 6
300
301
test_expect_success 'GIT_SKIP_TESTS sh pattern' '
302
(
303
- run_sub_test_lib_test git-skip-tests-sh-pattern \
303
+ write_and_run_sub_test_lib_test git-skip-tests-sh-pattern \
304
"GIT_SKIP_TESTS sh pattern" \
305
--skip="git.[2-5]" <<-\EOF &&
306
for i in 1 2 3 4 5 6
324
325
test_expect_success 'GIT_SKIP_TESTS entire suite' '
326
(
327
- run_sub_test_lib_test git-skip-tests-entire-suite \
327
+ write_and_run_sub_test_lib_test git-skip-tests-entire-suite \
328
"GIT_SKIP_TESTS entire suite" \
329
--skip="git" <<-\EOF &&
330
for i in 1 2 3
341
342
test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' '
343
(
344
- run_sub_test_lib_test git-skip-tests-unmatched-suite \
344
+ write_and_run_sub_test_lib_test git-skip-tests-unmatched-suite \
345
"GIT_SKIP_TESTS does not skip unmatched suite" \
346
--skip="notgit" <<-\EOF &&
347
for i in 1 2 3
361
'
362
363
test_expect_success '--run basic' '
364
- run_sub_test_lib_test run-basic \
364
+ write_and_run_sub_test_lib_test run-basic \
365
"--run basic" --run="1,3,5" <<-\EOF &&
366
for i in 1 2 3 4 5 6
367
do
382
'
383
384
test_expect_success '--run with a range' '
385
- run_sub_test_lib_test run-range \
385
+ write_and_run_sub_test_lib_test run-range \
386
"--run with a range" --run="1-3" <<-\EOF &&
387
for i in 1 2 3 4 5 6
388
do
403
'
404
405
test_expect_success '--run with two ranges' '
406
- run_sub_test_lib_test run-two-ranges \
406
+ write_and_run_sub_test_lib_test run-two-ranges \
407
"--run with two ranges" --run="1-2,5-6" <<-\EOF &&
408
for i in 1 2 3 4 5 6
409
do
424
'
425
426
test_expect_success '--run with a left open range' '
427
- run_sub_test_lib_test run-left-open-range \
427
+ write_and_run_sub_test_lib_test run-left-open-range \
428
"--run with a left open range" --run="-3" <<-\EOF &&
429
for i in 1 2 3 4 5 6
430
do
445
'
446
447
test_expect_success '--run with a right open range' '
448
- run_sub_test_lib_test run-right-open-range \
448
+ write_and_run_sub_test_lib_test run-right-open-range \
449
"--run with a right open range" --run="4-" <<-\EOF &&
450
for i in 1 2 3 4 5 6
451
do
466
'
467
468
test_expect_success '--run with basic negation' '
469
- run_sub_test_lib_test run-basic-neg \
469
+ write_and_run_sub_test_lib_test run-basic-neg \
470
"--run with basic negation" --run="!3" <<-\EOF &&
471
for i in 1 2 3 4 5 6
472
do
487
'
488
489
test_expect_success '--run with two negations' '
490
- run_sub_test_lib_test run-two-neg \
490
+ write_and_run_sub_test_lib_test run-two-neg \
491
"--run with two negations" --run="!3,!6" <<-\EOF &&
492
for i in 1 2 3 4 5 6
493
do
508
'
509
510
test_expect_success '--run a range and negation' '
511
- run_sub_test_lib_test run-range-and-neg \
511
+ write_and_run_sub_test_lib_test run-range-and-neg \
512
"--run a range and negation" --run="-4,!2" <<-\EOF &&
513
for i in 1 2 3 4 5 6
514
do
529
'
530
531
test_expect_success '--run range negation' '
532
- run_sub_test_lib_test run-range-neg \
532
+ write_and_run_sub_test_lib_test run-range-neg \
533
"--run range negation" --run="!1-3" <<-\EOF &&
534
for i in 1 2 3 4 5 6
535
do
550
'
551
552
test_expect_success '--run include, exclude and include' '
553
- run_sub_test_lib_test run-inc-neg-inc \
553
+ write_and_run_sub_test_lib_test run-inc-neg-inc \
554
"--run include, exclude and include" \
555
--run="1-5,!1-3,2" <<-\EOF &&
556
for i in 1 2 3 4 5 6
572
'
573
574
test_expect_success '--run include, exclude and include, comma separated' '
575
- run_sub_test_lib_test run-inc-neg-inc-comma \
575
+ write_and_run_sub_test_lib_test run-inc-neg-inc-comma \
576
"--run include, exclude and include, comma separated" \
577
--run=1-5,!1-3,2 <<-\EOF &&
578
for i in 1 2 3 4 5 6
594
'
595
596
test_expect_success '--run exclude and include' '
597
- run_sub_test_lib_test run-neg-inc \
597
+ write_and_run_sub_test_lib_test run-neg-inc \
598
"--run exclude and include" \
599
--run="!3-,5" <<-\EOF &&
600
for i in 1 2 3 4 5 6
616
'
617
618
test_expect_success '--run empty selectors' '
619
- run_sub_test_lib_test run-empty-sel \
619
+ write_and_run_sub_test_lib_test run-empty-sel \
620
"--run empty selectors" \
621
--run="1,,3,,,5" <<-\EOF &&
622
for i in 1 2 3 4 5 6
638
'
639
640
test_expect_success '--run substring selector' '
641
- run_sub_test_lib_test run-substring-selector \
641
+ write_and_run_sub_test_lib_test run-substring-selector \
642
"--run empty selectors" \
643
--run="relevant" <<-\EOF &&
644
test_expect_success "relevant test" "true"
662
'
663
664
test_expect_success '--run keyword selection' '
665
- run_sub_test_lib_test_err run-inv-range-start \
665
+ write_and_run_sub_test_lib_test_err run-inv-range-start \
666
"--run invalid range start" \
667
--run="a-5" <<-\EOF &&
668
test_expect_success "passing test #1" "true"
677
'
678
679
test_expect_success '--run invalid range end' '
680
- run_sub_test_lib_test_err run-inv-range-end \
680
+ write_and_run_sub_test_lib_test_err run-inv-range-end \
681
"--run invalid range end" \
682
--run="1-z" <<-\EOF &&
683
test_expect_success "passing test #1" "true"
692
'
693
694
test_expect_success 'tests respect prerequisites' '
695
- run_sub_test_lib_test prereqs "tests respect prereqs" <<-\EOF &&
695
+ write_and_run_sub_test_lib_test prereqs "tests respect prereqs" <<-\EOF &&
696
697
test_set_prereq HAVEIT
698
test_expect_success HAVEIT "prereq is satisfied" "true"
722
'
723
724
test_expect_success 'tests respect lazy prerequisites' '
725
- run_sub_test_lib_test lazy-prereqs "respect lazy prereqs" <<-\EOF &&
725
+ write_and_run_sub_test_lib_test lazy-prereqs "respect lazy prereqs" <<-\EOF &&
726
727
test_lazy_prereq LAZY_TRUE true
728
test_expect_success LAZY_TRUE "lazy prereq is satisifed" "true"
746
'
747
748
test_expect_success 'nested lazy prerequisites' '
749
- run_sub_test_lib_test nested-lazy "nested lazy prereqs" <<-\EOF &&
749
+ write_and_run_sub_test_lib_test nested-lazy "nested lazy prereqs" <<-\EOF &&
750
751
test_lazy_prereq NESTED_INNER "
752
>inner &&
772
'
773
774
test_expect_success 'lazy prereqs do not turn off tracing' '
775
- run_sub_test_lib_test lazy-prereq-and-tracing \
775
+ write_and_run_sub_test_lib_test lazy-prereq-and-tracing \
776
"lazy prereqs and -x" -v -x <<-\EOF &&
777
test_lazy_prereq LAZY true
778
785
'
786
787
test_expect_success 'tests clean up after themselves' '
788
- run_sub_test_lib_test cleanup "test with cleanup" <<-\EOF &&
788
+ write_and_run_sub_test_lib_test cleanup "test with cleanup" <<-\EOF &&
789
clean=no
790
test_expect_success "do cleanup" "
791
test_when_finished clean=yes
805
'
806
807
test_expect_success 'tests clean up even on failures' '
808
- run_sub_test_lib_test_err \
808
+ write_and_run_sub_test_lib_test_err \
809
failing-cleanup "Failing tests with cleanup commands" <<-\EOF &&
810
test_expect_success "tests clean up even after a failure" "
811
touch clean-after-failure &&
834
'
835
836
test_expect_success 'test_atexit is run' '
837
- run_sub_test_lib_test_err \
837
+ write_and_run_sub_test_lib_test_err \
838
atexit-cleanup "Run atexit commands" -i <<-\EOF &&
839
test_expect_success "tests clean up even after a failure" "
840
> ../../clean-atexit &&