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