tests command generation
(t *testing.T)
| 178 | |
| 179 | // tests command generation |
| 180 | func TestCommand(t *testing.T) { |
| 181 | // logx.UserLevel = slog.LevelDebug |
| 182 | tests := []exIn{ |
| 183 | { |
| 184 | `command list { |
| 185 | ls -la args... |
| 186 | }`, |
| 187 | `shell.AddCommand("list", func(args ...string) { |
| 188 | shell.Run("ls", "-la", "args...") |
| 189 | })`}, |
| 190 | } |
| 191 | |
| 192 | sh := NewShell() |
| 193 | for _, test := range tests { |
| 194 | sh.TranspileCode(test.i) |
| 195 | o := sh.Code() |
| 196 | assert.Equal(t, test.e, o) |
| 197 | } |
| 198 | } |
nothing calls this directly
no test coverage detected