From aa493d3a9e41267d71ff7f5cf846af7f3be6480c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 19 Aug 2023 08:09:24 +0200 Subject: [PATCH] Add failing test demonstrating bug with column alignments and removed columns When columns to the left of a column with an alignment are removed, the alignment applies to the wrong column. We'll fix this in the next commit. --- pkg/utils/formatting_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/utils/formatting_test.go b/pkg/utils/formatting_test.go index 38e3849ae..ab9e1460c 100644 --- a/pkg/utils/formatting_test.go +++ b/pkg/utils/formatting_test.go @@ -209,6 +209,14 @@ func TestRenderDisplayStrings(t *testing.T) { columnAlignments: []Alignment{AlignRight, AlignLeft}, expected: "abc d\n e f", }, + { + input: [][]string{{"a", "", "bcd", "efg", "h"}, {"i", "", "j", "k", "l"}}, + columnAlignments: []Alignment{AlignLeft, AlignLeft, AlignRight, AlignLeft}, + expected: "a bcd efg h\ni j k l", + /* Wrong, it should really be: + expected: "a bcd efg h\ni j k l", + */ + }, { input: [][]string{{"abc", "", "d", ""}, {"e", "", "f", ""}}, columnAlignments: []Alignment{AlignRight}, // gracefully defaults unspecified columns to left-align