(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func Test_NewCmdCheck(t *testing.T) { |
| 21 | tests := []struct { |
| 22 | name string |
| 23 | args string |
| 24 | isTTY bool |
| 25 | want CheckOptions |
| 26 | wantErr string |
| 27 | }{ |
| 28 | { |
| 29 | name: "no arguments", |
| 30 | args: "", |
| 31 | isTTY: true, |
| 32 | want: CheckOptions{ |
| 33 | Branch: "", |
| 34 | Default: false, |
| 35 | WebMode: false, |
| 36 | }, |
| 37 | }, |
| 38 | { |
| 39 | name: "branch name", |
| 40 | args: "my-branch", |
| 41 | isTTY: true, |
| 42 | want: CheckOptions{ |
| 43 | Branch: "my-branch", |
| 44 | Default: false, |
| 45 | WebMode: false, |
| 46 | }, |
| 47 | }, |
| 48 | { |
| 49 | name: "default", |
| 50 | args: "--default=true", |
| 51 | isTTY: true, |
| 52 | want: CheckOptions{ |
| 53 | Branch: "", |
| 54 | Default: true, |
| 55 | WebMode: false, |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | name: "web mode", |
| 60 | args: "--web", |
| 61 | isTTY: true, |
| 62 | want: CheckOptions{ |
| 63 | Branch: "", |
| 64 | Default: false, |
| 65 | WebMode: true, |
| 66 | }, |
| 67 | }, |
| 68 | { |
| 69 | name: "both --default and branch name specified", |
| 70 | args: "--default asdf", |
| 71 | isTTY: true, |
| 72 | wantErr: "specify only one of `--default` or a branch name", |
| 73 | }, |
| 74 | } |
| 75 | |
| 76 | for _, tt := range tests { |
| 77 | t.Run(tt.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected