(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestNewCmdSync(t *testing.T) { |
| 20 | tests := []struct { |
| 21 | name string |
| 22 | tty bool |
| 23 | input string |
| 24 | output SyncOptions |
| 25 | wantErr bool |
| 26 | errMsg string |
| 27 | }{ |
| 28 | { |
| 29 | name: "no argument", |
| 30 | tty: true, |
| 31 | input: "", |
| 32 | output: SyncOptions{}, |
| 33 | }, |
| 34 | { |
| 35 | name: "destination repo", |
| 36 | tty: true, |
| 37 | input: "cli/cli", |
| 38 | output: SyncOptions{ |
| 39 | DestArg: "cli/cli", |
| 40 | }, |
| 41 | }, |
| 42 | { |
| 43 | name: "source repo", |
| 44 | tty: true, |
| 45 | input: "--source cli/cli", |
| 46 | output: SyncOptions{ |
| 47 | SrcArg: "cli/cli", |
| 48 | }, |
| 49 | }, |
| 50 | { |
| 51 | name: "branch", |
| 52 | tty: true, |
| 53 | input: "--branch trunk", |
| 54 | output: SyncOptions{ |
| 55 | Branch: "trunk", |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | name: "force", |
| 60 | tty: true, |
| 61 | input: "--force", |
| 62 | output: SyncOptions{ |
| 63 | Force: true, |
| 64 | }, |
| 65 | }, |
| 66 | } |
| 67 | for _, tt := range tests { |
| 68 | t.Run(tt.name, func(t *testing.T) { |
| 69 | ios, _, _, _ := iostreams.Test() |
| 70 | ios.SetStdinTTY(tt.tty) |
| 71 | ios.SetStdoutTTY(tt.tty) |
| 72 | f := &cmdutil.Factory{ |
| 73 | IOStreams: ios, |
| 74 | } |
| 75 | argv, err := shlex.Split(tt.input) |
| 76 | assert.NoError(t, err) |
nothing calls this directly
no test coverage detected