(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestNewCmdCreate(t *testing.T) { |
| 58 | tests := []struct { |
| 59 | name string |
| 60 | cli string |
| 61 | factory func(*cmdutil.Factory) *cmdutil.Factory |
| 62 | wants CreateOptions |
| 63 | wantsErr bool |
| 64 | }{ |
| 65 | { |
| 66 | name: "no arguments", |
| 67 | cli: "", |
| 68 | wants: CreateOptions{ |
| 69 | Description: "", |
| 70 | Public: false, |
| 71 | Filenames: []string{""}, |
| 72 | }, |
| 73 | wantsErr: false, |
| 74 | }, |
| 75 | { |
| 76 | name: "no arguments with TTY stdin", |
| 77 | factory: func(f *cmdutil.Factory) *cmdutil.Factory { |
| 78 | f.IOStreams.SetStdinTTY(true) |
| 79 | return f |
| 80 | }, |
| 81 | cli: "", |
| 82 | wants: CreateOptions{ |
| 83 | Description: "", |
| 84 | Public: false, |
| 85 | Filenames: []string{""}, |
| 86 | }, |
| 87 | wantsErr: true, |
| 88 | }, |
| 89 | { |
| 90 | name: "stdin argument", |
| 91 | cli: "-", |
| 92 | wants: CreateOptions{ |
| 93 | Description: "", |
| 94 | Public: false, |
| 95 | Filenames: []string{"-"}, |
| 96 | }, |
| 97 | wantsErr: false, |
| 98 | }, |
| 99 | { |
| 100 | name: "with description", |
| 101 | cli: `-d "my new gist" -`, |
| 102 | wants: CreateOptions{ |
| 103 | Description: "my new gist", |
| 104 | Public: false, |
| 105 | Filenames: []string{"-"}, |
| 106 | }, |
| 107 | wantsErr: false, |
| 108 | }, |
| 109 | { |
| 110 | name: "public", |
| 111 | cli: `--public -`, |
| 112 | wants: CreateOptions{ |
| 113 | Description: "", |
| 114 | Public: true, |
nothing calls this directly
no test coverage detected