diff --git a/table/table_test.go b/table/table_test.go index 8c6da37..cfe8780 100644 --- a/table/table_test.go +++ b/table/table_test.go @@ -1,6 +1,7 @@ package table import ( + "strings" "testing" "github.com/charmbracelet/lipgloss/v2" @@ -124,7 +125,7 @@ func TestTableAlignment(t *testing.T) { {"Hobnobs", "UK", "Yes"}, }), ) - got := ansi.Strip(biscuits.View()) + got := ansiStrip(biscuits.View()) golden.RequireEqual(t, []byte(got)) }) t.Run("With border", func(t *testing.T) { @@ -153,7 +154,13 @@ func TestTableAlignment(t *testing.T) { }), WithStyles(s), ) - got := ansi.Strip(baseStyle.Render(biscuits.View())) + got := ansiStrip(baseStyle.Render(biscuits.View())) golden.RequireEqual(t, []byte(got)) }) } + +func ansiStrip(s string) string { + // Replace all \r\n with \n + s = strings.ReplaceAll(s, "\r\n", "\n") + return ansi.Strip(s) +}