Add Helper test for Windows
This commit is contained in:
parent
64d50e6fbc
commit
3803fd04b9
1 changed files with 15 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ package gitcredentials_test
|
|||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/cli/cli/v2/git"
|
||||
|
|
@ -135,9 +136,10 @@ func TestConfiguredHelperWithPreexistingHostHelperConfigured(t *testing.T) {
|
|||
|
||||
func TestHelperIsOurs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cmd string
|
||||
want bool
|
||||
name string
|
||||
cmd string
|
||||
want bool
|
||||
windowsOnly bool
|
||||
}{
|
||||
{
|
||||
name: "blank",
|
||||
|
|
@ -164,9 +166,19 @@ func TestHelperIsOurs(t *testing.T) {
|
|||
cmd: "!/path/to/gh auth",
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "ours - Windows edition",
|
||||
cmd: `!'C:\Program Files\GitHub CLI\gh.exe' auth git-credential`,
|
||||
want: true,
|
||||
windowsOnly: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.windowsOnly && runtime.GOOS != "windows" {
|
||||
t.Skip("skipping test on non-Windows platform")
|
||||
}
|
||||
|
||||
h := gitcredentials.Helper{Cmd: tt.cmd}
|
||||
if got := h.IsOurs(); got != tt.want {
|
||||
t.Errorf("IsOurs() = %v, want %v", got, tt.want)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue