(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func Test_viewMetaFor(t *testing.T) { |
| 15 | uu := map[string]struct { |
| 16 | cmd string |
| 17 | gvr *client.GVR |
| 18 | p *cmd.Interpreter |
| 19 | err error |
| 20 | }{ |
| 21 | "empty": { |
| 22 | cmd: "", |
| 23 | gvr: client.PodGVR, |
| 24 | err: errors.New("`` command not found"), |
| 25 | }, |
| 26 | |
| 27 | "toast": { |
| 28 | cmd: "v1/pd", |
| 29 | gvr: client.PodGVR, |
| 30 | err: errors.New("`v1/pd` command not found"), |
| 31 | }, |
| 32 | |
| 33 | "gvr": { |
| 34 | cmd: "v1/pods", |
| 35 | gvr: client.PodGVR, |
| 36 | p: cmd.NewInterpreter("v1/pods"), |
| 37 | err: errors.New("blah"), |
| 38 | }, |
| 39 | |
| 40 | "short-name": { |
| 41 | cmd: "po", |
| 42 | gvr: client.PodGVR, |
| 43 | p: cmd.NewInterpreter("v1/pods", "po"), |
| 44 | err: errors.New("blee"), |
| 45 | }, |
| 46 | |
| 47 | "custom-alias": { |
| 48 | cmd: "pdl", |
| 49 | gvr: client.PodGVR, |
| 50 | p: cmd.NewInterpreter("v1/pods @fred 'app=blee' default", "pdl"), |
| 51 | err: errors.New("blee"), |
| 52 | }, |
| 53 | |
| 54 | "inception": { |
| 55 | cmd: "pdal blee", |
| 56 | gvr: client.PodGVR, |
| 57 | p: cmd.NewInterpreter("v1/pods @fred 'app=blee' blee", "pdal", "pod"), |
| 58 | err: errors.New("blee"), |
| 59 | }, |
| 60 | } |
| 61 | |
| 62 | c := &Command{ |
| 63 | alias: &dao.Alias{ |
| 64 | Aliases: config.NewAliases(), |
| 65 | }, |
| 66 | } |
| 67 | c.alias.Define(client.PodGVR, "po", "pod", "pods", client.PodGVR.String()) |
| 68 | c.alias.Define(client.NewGVR("pod default"), "pd") |
| 69 | c.alias.Define(client.NewGVR("pod @fred 'app=blee' default"), "pdl") |
| 70 | c.alias.Define(client.NewGVR("pdl"), "pdal") |
| 71 |
nothing calls this directly
no test coverage detected
searching dependent graphs…