Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Let's try again
  • Loading branch information
kyleconroy committed Dec 5, 2023
commit 0de46b7294225c07016da79687eab5f4a0a97ea9
12 changes: 10 additions & 2 deletions internal/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,23 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) {
t.Fatal(err)
}

if !cmp.Equal(expected, actual, cmpopts.EquateEmpty()) {
opts := []cmp.Option{
cmpopts.EquateEmpty(),
cmp.Transformer("LineEndings", func(in string) string {
// Replace Windows new lines with Unix newlines
return strings.Replace(in, "\r\n", "\n", -1)
}),
}

if !cmp.Equal(expected, actual, opts...) {
t.Errorf("%s contents differ", dir)
for name, contents := range expected {
name := name
if actual[name] == "" {
t.Errorf("%s is empty", name)
return
}
if diff := cmp.Diff(contents, actual[name]); diff != "" {
if diff := cmp.Diff(contents, actual[name], opts...); diff != "" {
t.Errorf("%s differed (-want +got):\n%s", name, diff)
}
}
Expand Down