Skip to content

Commit 9f05a63

Browse files
committed
fine tune test code
1 parent bf6e236 commit 9f05a63

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/integration/git_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"path"
1616
"path/filepath"
1717
"strconv"
18-
"strings"
1918
"testing"
2019
"time"
2120

@@ -986,13 +985,12 @@ func TestAgitPullPush(t *testing.T) {
986985
assert.NoError(t, err)
987986

988987
// test force push without confirm
989-
stderr := strings.Builder{}
990-
err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test-agit-push").Run(&git.RunOpts{Dir: dstPath, Stderr: &stderr})
988+
_, stderr, err := git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test-agit-push").RunStdString(&git.RunOpts{Dir: dstPath})
991989
assert.Error(t, err)
992-
assert.Contains(t, stderr.String(), "[remote rejected] HEAD -> refs/for/master/test-agit-push (request `force-push` push option)")
990+
assert.Contains(t, stderr, "[remote rejected] HEAD -> refs/for/master/test-agit-push (request `force-push` push option)")
993991

994992
// test force push with confirm
995-
err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test-agit-push", "-o", "force-push").Run(&git.RunOpts{Dir: dstPath, Stderr: &stderr})
993+
err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test-agit-push", "-o", "force-push").Run(&git.RunOpts{Dir: dstPath})
996994
assert.NoError(t, err)
997995
})
998996
}

0 commit comments

Comments
 (0)