1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

Made error handling better

This commit is contained in:
mjarkk
2018-10-29 08:23:56 +01:00
parent 1e0310a86d
commit 9585f49490
4 changed files with 26 additions and 17 deletions

View File

@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"strings"
"testing"
"time"
@ -1008,23 +1009,23 @@ func TestGitCommandPush(t *testing.T) {
},
false,
func(err error) {
assert.Error(t, err)
assert.Nil(t, err)
},
},
}
for i, s := range scenarios {
for _, s := range scenarios {
t.Run(s.testName, func(t *testing.T) {
gitCmd := newDummyGitCommand()
gitCmd.OSCommand.command = s.command
err := gitCmd.Push("test", s.forcePush, func(passOrUname string) string {
return "-"
})
if err.Error() == "exit status 1" && i != 2 {
s.test(nil)
} else {
s.test(err)
errMessage := err.Error()
if strings.Contains(errMessage, "error: src refspec test does not match any.") {
err = nil
}
s.test(err)
})
}
}