Skip to content

Commit

Permalink
internal/cuetxtar: Correct nesting of tests
Browse files Browse the repository at this point in the history
TxTarTest.Run passed the wrong testing.T to TxTarTest.run which led to
confused nesting of tests.

Also, be explicit about use of DebugArchive always causing tests to
error - although that was clear from the code, it was not clear from the
test output.

Signed-off-by: Matthew Sackman <[email protected]>
Change-Id: I2c4d7acabe2eed8d9433d9960533bb50458622e2
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198556
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
cuematthew committed Jul 29, 2024
1 parent b77c599 commit dc199f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/cuetxtar/txtar.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (x *TxTarTest) Run(t *testing.T, f func(tc *Test)) {
if s := m.Name(); s != cuetdtest.DefaultVersion {
test.Name += "-" + s
}
test.run(t, func(tc *Test) {
test.run(m.T, func(tc *Test) {
tc.M = m
f(tc)
})
Expand Down Expand Up @@ -379,8 +379,9 @@ func (x *TxTarTest) run(t *testing.T, f func(tc *Test)) {

f(tc)

// Unconditionally output as an error.
t.Error(tc.buf.String())
// Unconditionally log the output and fail.
t.Log(tc.buf.String())
t.Error("DebugArchive tests always fail")
})
return
}
Expand Down

0 comments on commit dc199f5

Please sign in to comment.