(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestJavaStyle(t *testing.T) { |
| 279 | fooHelp := ` |
| 280 | usage: foo <flags> |
| 281 | |
| 282 | -h show help |
| 283 | -v be verbose |
| 284 | -E expand something |
| 285 | -T expand something |
| 286 | -a same as -vET |
| 287 | ` |
| 288 | |
| 289 | desc, err := ParseHelp([]string{"foo", "-h"}, fooHelp) |
| 290 | require.Nil(t, err) |
| 291 | |
| 292 | expected := datastore.HelpPage{ |
| 293 | ExecutablePath: "foo", |
| 294 | Completions: []datastore.Completion{ |
| 295 | {Flag: "-h"}, |
| 296 | {Flag: "-v"}, |
| 297 | {Flag: "-E"}, |
| 298 | {Flag: "-T"}, |
| 299 | {Flag: "-a"}, |
| 300 | {Flag: "-vET"}, // it might be |
| 301 | }, |
| 302 | CheckSum: "5854f53d08357f31d7c9e5d478b12a0a2236c976", |
| 303 | } |
| 304 | require.Equal(t, expected, *desc) |
| 305 | } |
| 306 | |
| 307 | func TestOptionInVeryBeginningOfLine(t *testing.T) { |
| 308 | fooHelp := ` |
nothing calls this directly
no test coverage detected