(t *testing.T)
| 96 | } |
| 97 | |
| 98 | func TestSetRun(t *testing.T) { |
| 99 | tests := []struct { |
| 100 | name string |
| 101 | tty bool |
| 102 | opts *SetOptions |
| 103 | stdin string |
| 104 | wantExpansion string |
| 105 | wantStdout string |
| 106 | wantStderr string |
| 107 | wantErrMsg string |
| 108 | }{ |
| 109 | { |
| 110 | name: "creates alias tty", |
| 111 | tty: true, |
| 112 | opts: &SetOptions{ |
| 113 | Name: "foo", |
| 114 | Expansion: "bar", |
| 115 | }, |
| 116 | wantExpansion: "bar", |
| 117 | wantStderr: "- Creating alias for foo: bar\n✓ Added alias foo\n", |
| 118 | }, |
| 119 | { |
| 120 | name: "creates alias", |
| 121 | opts: &SetOptions{ |
| 122 | Name: "foo", |
| 123 | Expansion: "bar", |
| 124 | }, |
| 125 | wantExpansion: "bar", |
| 126 | }, |
| 127 | { |
| 128 | name: "creates shell alias tty", |
| 129 | tty: true, |
| 130 | opts: &SetOptions{ |
| 131 | Name: "igrep", |
| 132 | Expansion: "!gh issue list | grep", |
| 133 | }, |
| 134 | wantExpansion: "!gh issue list | grep", |
| 135 | wantStderr: "- Creating alias for igrep: !gh issue list | grep\n✓ Added alias igrep\n", |
| 136 | }, |
| 137 | { |
| 138 | name: "creates shell alias", |
| 139 | opts: &SetOptions{ |
| 140 | Name: "igrep", |
| 141 | Expansion: "!gh issue list | grep", |
| 142 | }, |
| 143 | wantExpansion: "!gh issue list | grep", |
| 144 | }, |
| 145 | { |
| 146 | name: "creates shell alias using flag tty", |
| 147 | tty: true, |
| 148 | opts: &SetOptions{ |
| 149 | Name: "igrep", |
| 150 | Expansion: "gh issue list | grep", |
| 151 | IsShell: true, |
| 152 | }, |
| 153 | wantExpansion: "!gh issue list | grep", |
| 154 | wantStderr: "- Creating alias for igrep: !gh issue list | grep\n✓ Added alias igrep\n", |
| 155 | }, |
nothing calls this directly
no test coverage detected