TestCmd_fail verifies that that command returns an error rather than exiting the process
(t *testing.T)
| 154 | |
| 155 | // TestCmd_fail verifies that that command returns an error rather than exiting the process |
| 156 | func TestCmd_fail(t *testing.T) { |
| 157 | r := cmdget.NewRunner("kpt") |
| 158 | r.Command.SilenceErrors = true |
| 159 | r.Command.SilenceUsage = true |
| 160 | r.Command.SetArgs([]string{"file://" + filepath.Join("not", "real", "dir") + ".git/@master", "./"}) |
| 161 | err := r.Command.Execute() |
| 162 | if !assert.Error(t, err) { |
| 163 | return |
| 164 | } |
| 165 | assert.Contains(t, err.Error(), "failed to lookup master(or main) branch") |
| 166 | } |
| 167 | |
| 168 | // TestCmd_git tests that if a package path contains .git, it is still parsed correctly |
| 169 | func TestCmd_git(t *testing.T) { |