@@ -19,6 +19,7 @@ modification *should* take notice and update the test vectors here.
19
19
'
20
20
21
21
. ./test-lib.sh
22
+ . " $TEST_DIRECTORY " /lib-subtest.sh
22
23
23
24
try_local_xy () {
24
25
local x=" local" y=" alsolocal" &&
@@ -66,93 +67,6 @@ test_expect_success 'success is reported like this' '
66
67
:
67
68
'
68
69
69
- _run_sub_test_lib_test_common () {
70
- neg=" $1 " name=" $2 " descr=" $3 " # stdin is the body of the test code
71
- shift 3
72
-
73
- # intercept pseudo-options at the front of the argument list that we
74
- # will not pass to child script
75
- skip=
76
- while test $# -gt 0
77
- do
78
- case " $1 " in
79
- --skip=* )
80
- skip=${1# --* =}
81
- shift
82
- ;;
83
- * )
84
- break
85
- ;;
86
- esac
87
- done
88
-
89
- mkdir " $name " &&
90
- (
91
- # Pretend we're not running under a test harness, whether we
92
- # are or not. The test-lib output depends on the setting of
93
- # this variable, so we need a stable setting under which to run
94
- # the sub-test.
95
- sane_unset HARNESS_ACTIVE &&
96
- cd " $name " &&
97
- write_script " $name .sh" " $TEST_SHELL_PATH " << -EOF &&
98
- test_description='$descr (run in sub test-lib)
99
-
100
- This is run in a sub test-lib so that we do not get incorrect
101
- passing metrics
102
- '
103
-
104
- # Point to the t/test-lib.sh, which isn't in ../ as usual
105
- . "\$ TEST_DIRECTORY"/test-lib.sh
106
- EOF
107
- cat >> " $name .sh" &&
108
- export TEST_DIRECTORY &&
109
- # The child test re-sources GIT-BUILD-OPTIONS and may thus
110
- # override the test output directory. We thus pass it as an
111
- # explicit override to the child.
112
- TEST_OUTPUT_DIRECTORY_OVERRIDE=$( pwd) &&
113
- export TEST_OUTPUT_DIRECTORY_OVERRIDE &&
114
- GIT_SKIP_TESTS=$skip &&
115
- export GIT_SKIP_TESTS &&
116
- sane_unset GIT_TEST_FAIL_PREREQS &&
117
- if test -z " $neg "
118
- then
119
- ./" $name .sh" " $@ " > out 2> err
120
- else
121
- ! ./" $name .sh" " $@ " > out 2> err
122
- fi
123
- )
124
- }
125
-
126
- run_sub_test_lib_test () {
127
- _run_sub_test_lib_test_common ' ' " $@ "
128
- }
129
-
130
- run_sub_test_lib_test_err () {
131
- _run_sub_test_lib_test_common ' !' " $@ "
132
- }
133
-
134
- check_sub_test_lib_test () {
135
- name=" $1 " # stdin is the expected output from the test
136
- (
137
- cd " $name " &&
138
- test_must_be_empty err &&
139
- sed -e ' s/^> //' -e ' s/Z$//' > expect &&
140
- test_cmp expect out
141
- )
142
- }
143
-
144
- check_sub_test_lib_test_err () {
145
- name=" $1 " # stdin is the expected output from the test
146
- # expected error output is in descriptor 3
147
- (
148
- cd " $name " &&
149
- sed -e ' s/^> //' -e ' s/Z$//' > expect.out &&
150
- test_cmp expect.out out &&
151
- sed -e ' s/^> //' -e ' s/Z$//' < & 3 > expect.err &&
152
- test_cmp expect.err err
153
- )
154
- }
155
-
156
70
test_expect_success ' pretend we have a fully passing test suite' '
157
71
run_sub_test_lib_test full-pass "3 passing tests" <<-\EOF &&
158
72
for i in 1 2 3
0 commit comments