From d7513ef3f6cf252b6418613622e60593718be9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 16 Dec 2019 14:56:44 +0100 Subject: [PATCH] Fix test assertion when running on Windows --- git/git_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git/git_test.go b/git/git_test.go index dc1446c33..ebf10baf9 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -3,7 +3,7 @@ package git import ( "fmt" "os" - "strings" + "regexp" "testing" "github.com/github/gh-cli/test" @@ -51,7 +51,8 @@ func Test_UncommittedChangeCount(t *testing.T) { GitCommand = test.StubExecCommand("TestGitStatusHelperProcess", "boom") _, err := UncommittedChangeCount() - if !strings.HasSuffix(err.Error(), "git.test: exit status 1") { + errorRE := regexp.MustCompile(`git\.test(\.exe)?: exit status 1$`) + if !errorRE.MatchString(err.Error()) { t.Errorf("got unexpected error message: %s", err) } }