(t *testing.T)
| 2102 | } |
| 2103 | |
| 2104 | func TestPushDefault(t *testing.T) { |
| 2105 | t.Run("it parses valid values correctly", func(t *testing.T) { |
| 2106 | t.Parallel() |
| 2107 | |
| 2108 | tests := []struct { |
| 2109 | value string |
| 2110 | expectedPushDefault PushDefault |
| 2111 | }{ |
| 2112 | {"nothing", PushDefaultNothing}, |
| 2113 | {"current", PushDefaultCurrent}, |
| 2114 | {"upstream", PushDefaultUpstream}, |
| 2115 | {"tracking", PushDefaultTracking}, |
| 2116 | {"simple", PushDefaultSimple}, |
| 2117 | {"matching", PushDefaultMatching}, |
| 2118 | } |
| 2119 | |
| 2120 | for _, test := range tests { |
| 2121 | t.Run(test.value, func(t *testing.T) { |
| 2122 | t.Parallel() |
| 2123 | |
| 2124 | pushDefault, err := ParsePushDefault(test.value) |
| 2125 | require.NoError(t, err) |
| 2126 | assert.Equal(t, test.expectedPushDefault, pushDefault) |
| 2127 | }) |
| 2128 | } |
| 2129 | }) |
| 2130 | |
| 2131 | t.Run("it returns an error for invalid values", func(t *testing.T) { |
| 2132 | t.Parallel() |
| 2133 | |
| 2134 | _, err := ParsePushDefault("invalid") |
| 2135 | require.Error(t, err) |
| 2136 | }) |
| 2137 | } |
| 2138 | |
| 2139 | func createCommandContext(t *testing.T, exitStatus int, stdout, stderr string) (*exec.Cmd, commandCtx) { |
| 2140 | cmd := exec.CommandContext(context.Background(), os.Args[0], "-test.run=TestHelperProcess", "--") |
nothing calls this directly
no test coverage detected