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