(t *testing.T)
| 20 | ) |
| 21 | |
| 22 | func TestNewCmdView(t *testing.T) { |
| 23 | tests := []struct { |
| 24 | name string |
| 25 | cli string |
| 26 | wants ViewOptions |
| 27 | tty bool |
| 28 | }{ |
| 29 | { |
| 30 | name: "tty no arguments", |
| 31 | tty: true, |
| 32 | cli: "123", |
| 33 | wants: ViewOptions{ |
| 34 | Raw: false, |
| 35 | Selector: "123", |
| 36 | ListFiles: false, |
| 37 | }, |
| 38 | }, |
| 39 | { |
| 40 | name: "nontty no arguments", |
| 41 | cli: "123", |
| 42 | wants: ViewOptions{ |
| 43 | Raw: true, |
| 44 | Selector: "123", |
| 45 | ListFiles: false, |
| 46 | }, |
| 47 | }, |
| 48 | { |
| 49 | name: "filename passed", |
| 50 | cli: "-fcool.txt 123", |
| 51 | tty: true, |
| 52 | wants: ViewOptions{ |
| 53 | Raw: false, |
| 54 | Selector: "123", |
| 55 | Filename: "cool.txt", |
| 56 | ListFiles: false, |
| 57 | }, |
| 58 | }, |
| 59 | { |
| 60 | name: "files passed", |
| 61 | cli: "--files 123", |
| 62 | tty: true, |
| 63 | wants: ViewOptions{ |
| 64 | Raw: false, |
| 65 | Selector: "123", |
| 66 | ListFiles: true, |
| 67 | }, |
| 68 | }, |
| 69 | { |
| 70 | name: "tty no ID supplied", |
| 71 | cli: "", |
| 72 | tty: true, |
| 73 | wants: ViewOptions{ |
| 74 | Raw: false, |
| 75 | Selector: "", |
| 76 | ListFiles: true, |
| 77 | }, |
| 78 | }, |
| 79 | } |
nothing calls this directly
no test coverage detected