commit - beae6fa9c8f59ad6441260412add9b9c84617cac
commit + 9d3bc9e22e36abc872ea2082e4bad194d395cdf4
blob - 24910f8393b757b52c969b7ed1a3a5b45a66f664
blob + 78fc2082dc1554a3a5beb1ad0275fe109b350328
--- exercise
+++ exercise
set exe [file join $basedir $path]
# If verbose, report started tests to stdout.
- if {$opts(-v)} {qputs $path}
+ if {$opts(-v)} {qputs . $path}
if {$suite} {
# Pass stderr through when calling test suites.
if {$suite} {
# Pass quoted output, adding one level of quoting.
- if {$opts(-v) && [string index $out 0] eq ">"} {
- qputs $out
+ if {$opts(-v) && [string index $out 0] eq "."} {
+ qputs . $out
continue
}
set scounters [sanitize_suite_counters $out]
print_progress [add_suite_counters $counters $scounters]
} elseif {$opts(-v) >= 2} {
- qputs "> $out"
+ qputs ". >" $out
}
}
}
}
-proc qputs {s} {
+proc qputs {prefix s} {
global esc
if {[isatty stdout]} {
- puts [string cat {*}[color 7 [list "> "]] $s {*}$esc(ce)]
+ puts [string cat {*}[color 7 [list "$prefix "]] $s {*}$esc(ce)]
} else {
- puts "> $s"
+ puts "$prefix $s"
}
}
blob - 8c973ee467abc39802e149a9abc5ffbc17f51472
blob + 24b4a6ffedbf654c6f198a9cc8b3e051a1f9450f
--- exercise.1
+++ exercise.1
.It Fl v
Be verbose.
Print the name of each test to standard output preceded by
-.Dq "> " .
+.Dq ". " .
If given twice, also print any test standard output
-with an additional level of quoting.
+with an additional level of quoting using
+.Dq "> " .
.El
.
.Ss Test Files
.Nm
utility can be used as a (nested) test suite runner if desired.
.Pp
+A test suite must admit the
+.Fl v
+option.
+It may honor it by printing test names to its standard output,
+prefixed with
+.Dq ". "
+to distinguish them from regular status lines.
+If
+.Fl vv
+is given, more diagnostics may be printed which,
+by convention, should be prefixed with
+.Dq ". >"
+(period, space, greater-than).
+.Pp
After running a test suite, its final report is checked for consistency.
If any of the conditions (listed below) are not satisfied,
the entire test suite is discarded and counted as a single
blob - 9c22585ae2e9587d11e6592284a19d66ccf4e4cb
blob + 012ad1fc058bde22aa41aa231fb36d9baab8d986
--- support/adapt-tst
+++ support/adapt-tst
while read -r line
do
case "$line" in
- ' '*) [ $vflag -ge 2 ] && echo "> >$line"
+ ' '*) [ $vflag -ge 2 ] && echo ". >$line"
continue ;;
esac
IFS=' ' read -r name result <<-EOF
EOF
case "$result" in
- OK | FAIL) [ $vflag -ge 1 ] && echo "> $name" ;;
- -) [ $vflag -ge 2 ] && echo "> $name skipped" ;;
+ OK | FAIL) [ $vflag -ge 1 ] && echo ". $name" ;;
+ -) [ $vflag -ge 2 ] && echo ". $name skipped" ;;
esac
case "$result" in
blob - 67375a31ca9192a3298094d2896e134ff5c27eac
blob + 955ed394a09a4258528f0439fa587c6a2b68737e
--- tests/exercise/flag/v.t
+++ tests/exercise/flag/v.t
set -e
./assert-exercise $0 \
- "> $0.tst\nrun 1 ok 1 fail 0 error 0\n" \
+ ". $0.tst\nrun 1 ok 1 fail 0 error 0\n" \
'' \
-v <<EOF
#!/bin/sh
EOF
./assert-exercise $0 \
- "> $0.tst\n" \
+ ". $0.tst\n" \
'' \
-qv <<EOF
#!/bin/sh
EOF
./assert-exercise $0 \
- "> $0.tst\n> > hallo welt\nrun 1 ok 1 fail 0 error 0\n" \
+ ". $0.tst\n. > hallo welt\nrun 1 ok 1 fail 0 error 0\n" \
'' \
-vv <<EOF
#!/bin/sh
export tst=$0.ts
./assert-exercise $0 \
- "> $0.ts\n> > test1\n> > test2\nrun 2 ok 2 fail 0 error 0\n" \
+ ". $0.ts\n. . test1\n. . test2\nrun 2 ok 2 fail 0 error 0\n" \
'' \
-v <<EOF
#!/bin/sh
echo "run 2 ok 0 fail 0 error 0"
- echo "> test1"
+ echo ". test1"
echo "run 2 ok 1 fail 0 error 0"
- echo "> test2"
+ echo ". test2"
echo "run 2 ok 2 fail 0 error 0"
test "\$1" = "-v"
EOF
export tst=$0.ts
./assert-exercise $0 \
- "> $0.ts\n> > test1\n> > > hallo\nrun 1 ok 1 fail 0 error 0\n" \
+ ". $0.ts\n. . test1\n. . > hallo\nrun 1 ok 1 fail 0 error 0\n" \
'' \
-vv <<EOF
#!/bin/sh
echo "run 1 ok 0 fail 0 error 0"
- echo "> test1"
- echo "> > hallo"
+ echo ". test1"
+ echo ". > hallo"
echo "run 1 ok 1 fail 0 error 0"
test "\$1" = "-vv"
EOF
blob - ea341fe95ef8a87f05c21a948248710270c5d57f
blob + 366dc8f8ffb7e1bda6ee182c13795b2854bf6ba6
--- tests/support/adapt-tst.t
+++ tests/support/adapt-tst.t
EOF
./assert-exercise $0 \
- "> $tst\n> > test_1()\n> > test_2()\n> > test_3()\n\
+ ". $tst\n. . test_1()\n. . test_2()\n. . test_3()\n\
run 3 ok 2 fail 1 error 0\n" \
"something something unexpected\ntest_3()\tFAIL\nfail $tst\n\n" \
-v \
EOF
./assert-exercise $0 \
- "> $tst\n> > foo()\tskipped\n> > test_1()\n> > >\tbemerke auch\n\
-> > test_2()\n> > test_3()\nrun 3 ok 2 fail 1 error 0\n" \
+ ". $tst\n. . foo()\tskipped\n. . test_1()\n. . >\tbemerke auch\n\
+. . test_2()\n. . test_3()\nrun 3 ok 2 fail 1 error 0\n" \
"something something unexpected\ntest_3()\tFAIL\nfail $tst\n\n" \
-vv \
<<-EOF