Re: [PATCH 2/7] test-lib: add say_color_tap helper to emit TAP format
From: Junio C Hamano <hidden>
Date: 2021-03-10 00:41:03
Ævar Arnfjörð Bjarmason [off-list ref] writes:
Follow-up 5099b99d25 (test-lib: Adjust output to be valid TAP format, 2010-06-24) and make it easy to distinguishing when we're emitting TAP directives (with the new "say_color_tap"), and when we just want to say something with colored text "say_color".
OK.
quoted hunk
@@ -666,7 +673,7 @@ test_ok_ () { write_junit_xml_testcase "$*" fi test_success=$(($test_success + 1)) - say_color "" "ok $test_count - $@" + say_color_tap "" "ok $test_count - $@"
Not your fault, but let's not forget that we should clean this up not to use "$@" here (and instead use $*).
- say_color warn "not ok $test_count - $@ # TODO known breakage" + say_color_tap warn "not ok $test_count - $@ # TODO known breakage"
Likewise.
Yes, I know say_color (and hence its heir say_color_tap) accepts
multiple arguments and eventually pastes them into a single string
with "$*", but there is no point in producing multiple arguments out
of "$@" here in this case.
fn0 () {
cnt=0
for arg
do
echo "$cnt: <$arg>"
cnt=$(( cnt+1 ))
done
}
fn1 () {
fn0 "not - $@ # TODO"
}
fn1 1 "2 3"
--->
0: <not - 1>
1: <2 3 # TODO>