MCPcopy Create free account
hub / github.com/dim-an/cod / TestJavaStyle

Function TestJavaStyle

parse_doc/parse_help_test.go:278–305  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

276}
277
278func 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
307func TestOptionInVeryBeginningOfLine(t *testing.T) {
308 fooHelp := `

Callers

nothing calls this directly

Calls 1

ParseHelpFunction · 0.85

Tested by

no test coverage detected