TestUnknownGlobal checks that unknown globals report errors
(t *testing.T)
| 124 | |
| 125 | // TestUnknownGlobal checks that unknown globals report errors |
| 126 | func TestUnknownGlobal(t *testing.T) { |
| 127 | run, _, cleanup := prepare(t) |
| 128 | defer cleanup() |
| 129 | |
| 130 | for name, args := range map[string][]string{ |
| 131 | "no-val": {"--unknown", "helloworld"}, |
| 132 | "separate-val": {"--unknown", "foo", "helloworld"}, |
| 133 | "joined-val": {"--unknown=foo", "helloworld"}, |
| 134 | } { |
| 135 | t.Run(name, func(t *testing.T) { |
| 136 | res := icmd.RunCmd(run(args...)) |
| 137 | res.Assert(t, icmd.Expected{ |
| 138 | ExitCode: 125, |
| 139 | Out: icmd.None, |
| 140 | Err: "unknown flag: --unknown", |
| 141 | }) |
| 142 | }) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // TestCliPluginsVersion checks that `-v` and friends DTRT |
| 147 | func TestCliPluginsVersion(t *testing.T) { |