@@ -316,64 +316,6 @@ expected exit code $1, actual ${eval_ret}"
316316 echo >&3 " "
317317}
318318
319- # test_external runs external test scripts that provide continuous
320- # test output about their progress, and succeeds/fails on
321- # zero/non-zero exit code. It outputs the test output on stdout even
322- # in non-verbose mode, and announces the external script with "* run
323- # <n>: ..." before running it. When providing relative paths, keep in
324- # mind that all scripts run in "trash directory".
325- # Usage: test_external description command arguments...
326- # Example: test_external 'Perl API' perl ../path/to/test.pl
327- test_external () {
328- test " $# " -eq 3 ||
329- error >&5 " bug in the test script: not 3 parameters to test_external"
330- descr=" $1 "
331- shift
332- if ! test_skip " $descr " " $@ "
333- then
334- # Announce the script to reduce confusion about the
335- # test output that follows.
336- say_color " " " run $test_count : $descr ($* )"
337- # Run command; redirect its stderr to &4 as in
338- # test_run_, but keep its stdout on our stdout even in
339- # non-verbose mode.
340- " $@ " 2>&4
341- if [ " $? " = 0 ]
342- then
343- test_ok_ " $descr "
344- else
345- test_failure_ " $descr " " $@ "
346- fi
347- fi
348- }
349-
350- # Like test_external, but in addition tests that the command generated
351- # no output on stderr.
352- test_external_without_stderr () {
353- # The temporary file has no (and must have no) security
354- # implications.
355- tmp=" $TMPDIR " ; if [ -z " $tmp " ]; then tmp=/tmp; fi
356- stderr=" $tmp /todotxt-external-stderr.$$ .tmp"
357- test_external " $@ " 4> " $stderr "
358- [ -f " $stderr " ] || error " Internal error: $stderr disappeared."
359- descr=" no stderr: $1 "
360- shift
361- say >&3 " expecting no stderr from previous command"
362- if [ ! -s " $stderr " ]; then
363- rm " $stderr "
364- test_ok_ " $descr "
365- else
366- if [ " $verbose " = t ]; then
367- output=$( echo; echo Stderr is:; cat " $stderr " )
368- else
369- output=
370- fi
371- # rm first in case test_failure exits.
372- rm " $stderr "
373- test_failure_ " $descr " " $@ " " $output "
374- fi
375- }
376-
377319# This is not among top-level (test_expect_success | test_expect_failure)
378320# but is a prefix that can be used in the test script, like:
379321#
0 commit comments