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