handle windows line endings

This commit is contained in:
Ajitem Sahasrabuddhe 2019-12-08 13:52:50 +05:30
parent 646677ae0b
commit 0ce33c3785

View File

@ -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)
} }