MCPcopy Create free account
hub / github.com/docopt/docopt.go / TestPatternFlat

Function TestPatternFlat

docopt_test.go:23–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestPatternFlat(t *testing.T) {
24 q := patternList{
25 newArgument("N", nil),
26 newOption("-a", "", 0, false),
27 newArgument("M", nil)}
28 p, err := newRequired(
29 newOneOrMore(newArgument("N", nil)),
30 newOption("-a", "", 0, false),
31 newArgument("M", nil)).flat(patternDefault)
32 if reflect.DeepEqual(p, q) != true {
33 t.Error(err)
34 }
35
36 q = patternList{newOptionsShortcut()}
37 p, err = newRequired(
38 newOptional(newOptionsShortcut()),
39 newOptional(newOption("-a", "", 0, false))).flat(patternOptionSSHORTCUT)
40 if reflect.DeepEqual(p, q) != true {
41 t.Error(err)
42 }
43 return
44}
45
46func TestOption(t *testing.T) {
47 if !parseOption("-h").eq(newOption("-h", "", 0, false)) {

Callers

nothing calls this directly

Calls 8

newArgumentFunction · 0.85
newOptionFunction · 0.85
newRequiredFunction · 0.85
newOneOrMoreFunction · 0.85
newOptionsShortcutFunction · 0.85
newOptionalFunction · 0.85
flatMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected