From e2418047df36ffccfb96dc05c816757c96da6915 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 9 Nov 2026 15:28:12 +0100 Subject: [PATCH] Let benchmarks use WithSimulationScreen The next commit adds a benchmark that draws a view. Co-Authored-By: Claude Opus 5.5 --- pkg/gocui/view_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/gocui/view_test.go b/pkg/gocui/view_test.go index e4f2441b2..3727f4391 100644 --- a/pkg/gocui/view_test.go +++ b/pkg/gocui/view_test.go @@ -16,16 +16,16 @@ import ( ) // WithSimulationScreen swaps the package-level Screen for a tcell -// terminfo-backed mock terminal so tests can call view.draw() and -// inspect rendered cells via Screen.Get(). The previous Screen is -// restored on test cleanup. -func WithSimulationScreen(t *testing.T, width, height int) { - t.Helper() +// terminfo-backed mock terminal so tests and benchmarks can call +// view.draw() and inspect rendered cells via Screen.Get(). The previous +// Screen is restored on test cleanup. +func WithSimulationScreen(tb testing.TB, width, height int) { + tb.Helper() saved := Screen if err := (&Gui{}).tcellInitSimulation(width, height); err != nil { - t.Fatal(err) + tb.Fatal(err) } - t.Cleanup(func() { + tb.Cleanup(func() { Screen.Fini() Screen = saved })