From 82ec11b207c9caee82b9bdd2a040f7801186bd59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:42:42 +0000 Subject: [PATCH] Fix indentation in test file Co-authored-by: matthyx <20683409+matthyx@users.noreply.github.com> --- .../tableprinter/utils/utils_test.go | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/utils/utils_test.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/utils/utils_test.go index 90f98020..21c559dc 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/utils/utils_test.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/utils/utils_test.go @@ -337,67 +337,68 @@ func TestGetColorForVulnerabilitySeverity(t *testing.T) { } func TestCheckShortTerminalWidth(t *testing.T) { -tests := []struct { -name string -rows []table.Row -headers table.Row -// We can't predict the exact result since it depends on terminal size -// but we can test it doesn't panic with various inputs -shouldNotPanic bool -}{ -{ -name: "Normal string rows", -rows: []table.Row{ -{"cell1", "cell2", "cell3"}, -{"longer cell 1", "longer cell 2", "longer cell 3"}, -}, -headers: table.Row{"Header1", "Header2", "Header3"}, -shouldNotPanic: true, -}, -{ -name: "Rows with non-string values (map)", -rows: []table.Row{ -{"cell1", map[string]interface{}{"key": "value"}, "cell3"}, -{"cell4", "cell5", "cell6"}, -}, -headers: table.Row{"Header1", "Header2", "Header3"}, -shouldNotPanic: true, -}, -{ -name: "Headers with non-string values", -rows: []table.Row{ -{"cell1", "cell2", "cell3"}, -}, -headers: table.Row{"Header1", map[string]interface{}{"key": "value"}, "Header3"}, -shouldNotPanic: true, -}, -{ -name: "Both rows and headers with non-string values", -rows: []table.Row{ -{map[string]interface{}{"key": "value"}, "cell2", 123}, -}, -headers: table.Row{[]string{"a", "b"}, "Header2", true}, -shouldNotPanic: true, -}, -{ -name: "Empty rows", -rows: []table.Row{}, -headers: table.Row{"Header1", "Header2"}, -shouldNotPanic: true, -}, + tests := []struct { + name string + rows []table.Row + headers table.Row + // We can't predict the exact result since it depends on terminal size + // but we can test it doesn't panic with various inputs + shouldNotPanic bool + }{ + { + name: "Normal string rows", + rows: []table.Row{ + {"cell1", "cell2", "cell3"}, + {"longer cell 1", "longer cell 2", "longer cell 3"}, + }, + headers: table.Row{"Header1", "Header2", "Header3"}, + shouldNotPanic: true, + }, + { + name: "Rows with non-string values (map)", + rows: []table.Row{ + {"cell1", map[string]interface{}{"key": "value"}, "cell3"}, + {"cell4", "cell5", "cell6"}, + }, + headers: table.Row{"Header1", "Header2", "Header3"}, + shouldNotPanic: true, + }, + { + name: "Headers with non-string values", + rows: []table.Row{ + {"cell1", "cell2", "cell3"}, + }, + headers: table.Row{"Header1", map[string]interface{}{"key": "value"}, "Header3"}, + shouldNotPanic: true, + }, + { + name: "Both rows and headers with non-string values", + rows: []table.Row{ + {map[string]interface{}{"key": "value"}, "cell2", 123}, + }, + headers: table.Row{[]string{"a", "b"}, "Header2", true}, + shouldNotPanic: true, + }, + { + name: "Empty rows", + rows: []table.Row{}, + headers: table.Row{"Header1", "Header2"}, + shouldNotPanic: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + defer func() { + if r := recover(); r != nil { + if tt.shouldNotPanic { + t.Errorf("CheckShortTerminalWidth() panicked when it shouldn't: %v", r) + } + } + }() + // Call the function - we just want to ensure it doesn't panic + _ = CheckShortTerminalWidth(tt.rows, tt.headers) + }) + } } -for _, tt := range tests { -t.Run(tt.name, func(t *testing.T) { -defer func() { -if r := recover(); r != nil { -if tt.shouldNotPanic { -t.Errorf("CheckShortTerminalWidth() panicked when it shouldn't: %v", r) -} -} -}() -// Call the function - we just want to ensure it doesn't panic -_ = CheckShortTerminalWidth(tt.rows, tt.headers) -}) -} -}