From dc199f574e01c451c850298d9a21e0886d193d74 Mon Sep 17 00:00:00 2001 From: Matthew Sackman Date: Mon, 29 Jul 2024 14:56:09 +0100 Subject: [PATCH] internal/cuetxtar: Correct nesting of tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: I2c4d7acabe2eed8d9433d9960533bb50458622e2 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198556 TryBot-Result: CUEcueckoo Reviewed-by: Daniel Martí --- internal/cuetxtar/txtar.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cuetxtar/txtar.go b/internal/cuetxtar/txtar.go index 313f7e8b8bb..c5ef9d69df4 100644 --- a/internal/cuetxtar/txtar.go +++ b/internal/cuetxtar/txtar.go @@ -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) }) @@ -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 }