Skip to content

Commit dc199f5

Browse files
committed
internal/cuetxtar: Correct nesting of tests
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]>
1 parent b77c599 commit dc199f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/cuetxtar/txtar.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func (x *TxTarTest) Run(t *testing.T, f func(tc *Test)) {
334334
if s := m.Name(); s != cuetdtest.DefaultVersion {
335335
test.Name += "-" + s
336336
}
337-
test.run(t, func(tc *Test) {
337+
test.run(m.T, func(tc *Test) {
338338
tc.M = m
339339
f(tc)
340340
})
@@ -379,8 +379,9 @@ func (x *TxTarTest) run(t *testing.T, f func(tc *Test)) {
379379

380380
f(tc)
381381

382-
// Unconditionally output as an error.
383-
t.Error(tc.buf.String())
382+
// Unconditionally log the output and fail.
383+
t.Log(tc.buf.String())
384+
t.Error("DebugArchive tests always fail")
384385
})
385386
return
386387
}

0 commit comments

Comments
 (0)