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

Function TestPatternFixIdentities2

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

Source from the content-addressed store, hash-verified

1040}
1041
1042func TestPatternFixIdentities2(t *testing.T) {
1043 p := newRequired(
1044 newOptional(
1045 newArgument("X", nil),
1046 newArgument("N", nil)),
1047 newArgument("N", nil))
1048 if len(p.children) < 2 {
1049 t.FailNow()
1050 }
1051 if len(p.children[0].children) < 2 {
1052 t.FailNow()
1053 }
1054 if p.children[0].children[1].eq(p.children[1]) != true {
1055 t.Fail()
1056 }
1057 if p.children[0].children[1] == p.children[1] {
1058 t.Fail()
1059 }
1060 p.fixIdentities(nil)
1061 if p.children[0].children[1] != p.children[1] {
1062 t.Fail()
1063 }
1064}
1065
1066func TestLongOptionsErrorHandling(t *testing.T) {
1067 _, err := Parse("Usage: prog", []string{"--non-existent"}, true, "", false, false)

Callers

nothing calls this directly

Calls 5

newRequiredFunction · 0.85
newOptionalFunction · 0.85
newArgumentFunction · 0.85
fixIdentitiesMethod · 0.80
eqMethod · 0.45

Tested by

no test coverage detected