Skip to content

Commit

Permalink
Fix integration test for Windows systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krivak committed May 16, 2020
1 parent e954f0a commit 1d1cebb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions godot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ func TestFixIntegration(t *testing.T) {
}

fixed, err := Fix(testFile, file, fset, Settings{CheckAll: false})

if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
Expand All @@ -374,9 +373,12 @@ func TestFixIntegration(t *testing.T) {
len(expectedLines), len(fixedLines))
}
for i := range fixedLines {
if fixedLines[i] != expectedLines[i] {
// NOTE: This is a fix for Windows, not sure why this is happening
result := strings.TrimRight(fixedLines[i], "\r")
exp := strings.TrimRight(expectedLines[i], "\r")
if result != exp {
t.Fatalf("Wrong line %d in fixed file\n expected: %s\n got: %s",
i, expectedLines[i], fixedLines[i])
i, exp, result)
}
}
})
Expand All @@ -396,7 +398,6 @@ func TestFixIntegration(t *testing.T) {
}

fixed, err := Fix(testFile, file, fset, Settings{CheckAll: true})

if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
Expand All @@ -408,9 +409,12 @@ func TestFixIntegration(t *testing.T) {
len(expectedLines), len(fixedLines))
}
for i := range fixedLines {
if fixedLines[i] != expectedLines[i] {
// TODO: This is a fix for Windows, not sure why this is happening
result := strings.TrimRight(fixedLines[i], "\r")
exp := strings.TrimRight(expectedLines[i], "\r")
if result != exp {
t.Fatalf("Wrong line %d in fixed file\n expected: %s\n got: %s",
i, expectedLines[i], fixedLines[i])
i, exp, result)
}
}
})
Expand Down

0 comments on commit 1d1cebb

Please sign in to comment.