MCPcopy Create free account
hub / github.com/cli/cli / TestParsePushDefault

Function TestParsePushDefault

git/client_test.go:1680–1706  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1678}
1679
1680func TestParsePushDefault(t *testing.T) {
1681 tests := []struct {
1682 value string
1683 want PushDefault
1684 }{
1685 {value: "nothing", want: PushDefaultNothing},
1686 {value: "current", want: PushDefaultCurrent},
1687 {value: "upstream", want: PushDefaultUpstream},
1688 {value: "tracking", want: PushDefaultTracking},
1689 {value: "simple", want: PushDefaultSimple},
1690 {value: "matching", want: PushDefaultMatching},
1691 }
1692
1693 for _, tt := range tests {
1694 t.Run(tt.value, func(t *testing.T) {
1695 // Given a supported push.default value
1696 value := tt.value
1697
1698 // When it is parsed
1699 pushDefault, err := ParsePushDefault(value)
1700
1701 // Then the matching typed value is returned
1702 require.NoError(t, err)
1703 assert.Equal(t, tt.want, pushDefault)
1704 })
1705 }
1706}
1707
1708func TestParsePushDefaultReportsUnknownValue(t *testing.T) {
1709 // Given an unsupported push.default value

Callers

nothing calls this directly

Calls 3

ParsePushDefaultFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected