handle windows line endings

main
Ajitem Sahasrabuddhe 5 years ago
parent 646677ae0b
commit 0ce33c3785

@ -1,6 +1,7 @@
package cli package cli
import ( import (
"bytes"
"io/ioutil" "io/ioutil"
"testing" "testing"
) )
@ -73,6 +74,8 @@ func testApp() *App {
func expectFileContent(t *testing.T, file, expected string) { func expectFileContent(t *testing.T, file, expected string) {
data, err := ioutil.ReadFile(file) data, err := ioutil.ReadFile(file)
// Ignore windows line endings
expected = string(bytes.ReplaceAll([]byte(expected), []byte("\r\n"), []byte("\n")))
expect(t, err, nil) expect(t, err, nil)
expect(t, string(data), expected) expect(t, string(data), expected)
} }

Loading…
Cancel
Save