Skip to content

Commit 5e4708f

Browse files
authored
testscript: reset verbose on new blocks (#293)
"Reset" verbose in the case that we are using ContinueOnError so that the next block only shows verbose output in case it is also in error. This ensures that later blocks that are not in error, do not needlessly show verbose output because of an earlier block that was in error.
1 parent fa847a1 commit 5e4708f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

testscript/testdata/testscript_logging.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ FAIL: $$WORK${/}scripts${/}testscript.txt:9: unexpected command failure
7272
[exit status 1]
7373
FAIL: $$WORK${/}scripts${/}testscript.txt:9: unexpected command failure
7474
# comment 4 (0.000s)
75-
> printargs section3
76-
[stdout]
77-
["printargs" "section3"]
7875
# comment 5 (0.000s)
7976
> printargs section5
8077
[stdout]

testscript/testscript.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ func (ts *TestScript) run() {
622622
rewind()
623623
markTime()
624624
}
625+
626+
// "Reset" verbose in the case that we are using ContinueOnError
627+
// so that the next block only shows verbose output in case it
628+
// is also in error. This ensures that later blocks that are not
629+
// in error, do not needlessly show verbose output because of an
630+
// earlier block that was in error.
631+
verbose = ts.t.Verbose()
632+
625633
// Print phase heading and mark start of phase output.
626634
fmt.Fprintf(&ts.log, "%s\n", line)
627635
ts.mark = ts.log.Len()

0 commit comments

Comments
 (0)