From ff09af3fb8f5bede0de523723bbd00d6ef2ab71e Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sun, 23 Jun 2013 20:12:56 +0200 Subject: test-lib: verbose mode for only tests matching a pattern With the new --verbose-only= option, one can enable --verbose at a per-test granularity. The pattern is matched against the test number, e.g. ./t0000-basic.sh --verbose-only='2[0-2]' to see only the full output of test 20-22, while showing the rest in the one-liner format. As suggested by Jeff King, this takes care to wrap the entire test_expect_* block, but nothing else, in the verbose toggling. We can use the test_start/end functions from the previous commit for the purpose. This is arguably not *too* useful on its own, but makes the next patch easier to follow. Helped-by: Jeff King Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t0000-basic.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't/t0000-basic.sh') diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 6439cec910..4f1844f782 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -250,6 +250,30 @@ test_expect_success 'test --verbose' ' EOF ' +test_expect_success 'test --verbose-only' ' + test_must_fail run_sub_test_lib_test \ + test-verbose-only-2 "test verbose-only=2" \ + --verbose-only=2 <<-\EOF && + test_expect_success "passing test" true + test_expect_success "test with output" "echo foo" + test_expect_success "failing test" false + test_done + EOF + check_sub_test_lib_test test-verbose-only-2 <<-\EOF + > ok 1 - passing test + > Z + > expecting success: echo foo + > foo + > Z + > ok 2 - test with output + > Z + > not ok 3 - failing test + > # false + > # failed 1 among 3 test(s) + > 1..3 + EOF +' + test_set_prereq HAVEIT haveit=no test_expect_success HAVEIT 'test runs if prerequisite is satisfied' ' -- cgit v1.3