diff --git a/plugin/converter/jsonnet/jsonnet_test.go b/plugin/converter/jsonnet/jsonnet_test.go index a9dec7e8..94a661bb 100644 --- a/plugin/converter/jsonnet/jsonnet_test.go +++ b/plugin/converter/jsonnet/jsonnet_test.go @@ -46,13 +46,19 @@ func TestParse(t *testing.T) { req.Config.Data = string(before) - parsedFile, err := Parse(req, nil, 0, template, templateData) + got, err := Parse(req, nil, 0, template, templateData) if err != nil { t.Error(err) return } - if want, got := parsedFile, string(after); want != got { + want := string(after) + // on windows line endings are \r\n, lets change them to linux for comparison + if runtime.GOOS == "windows" { + want = strings.Replace(want, "\r\n", "\n", -1) + } + + if want != got { t.Errorf("Want %q got %q", want, got) } } diff --git a/plugin/converter/starlark_test.go b/plugin/converter/starlark_test.go index 2846ac63..72a86b01 100644 --- a/plugin/converter/starlark_test.go +++ b/plugin/converter/starlark_test.go @@ -16,6 +16,8 @@ package converter import ( "io/ioutil" + "runtime" + "strings" "testing" "github.com/drone/drone/core" @@ -117,7 +119,14 @@ func TestConvert_Multi(t *testing.T) { return } - if want, got := config.Data, string(after); want != got { + want := string(after) + // on windows line endings are \r\n, lets change them to linux for comparison + if runtime.GOOS == "windows" { + want = strings.Replace(want, "\r\n", "\n", -1) + } + + got := config.Data + if want != got { t.Errorf("Want %q got %q", want, got) } }