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

Function TestFormalUsage

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

Source from the content-addressed store, hash-verified

145}
146
147func TestFormalUsage(t *testing.T) {
148 doc := `
149 Usage: prog [-hv] ARG
150 prog N M
151
152 prog is a program`
153 usage := parseSection("usage:", doc)[0]
154 if usage != "Usage: prog [-hv] ARG\n prog N M" {
155 t.FailNow()
156 }
157 formal, err := formalUsage(usage)
158 if err != nil {
159 t.Fatal(err)
160 }
161 if formal != "( [-hv] ARG ) | ( N M )" {
162 t.Fail()
163 }
164 return
165}
166
167func TestParseArgv(t *testing.T) {
168 o := patternList{

Callers

nothing calls this directly

Calls 2

parseSectionFunction · 0.85
formalUsageFunction · 0.85

Tested by

no test coverage detected