(t *testing.T)
| 1345 | } |
| 1346 | |
| 1347 | func TestParseSection(t *testing.T) { |
| 1348 | v := parseSection("usage:", "foo bar fizz buzz") |
| 1349 | w := []string{} |
| 1350 | if reflect.DeepEqual(v, w) != true { |
| 1351 | t.Fail() |
| 1352 | } |
| 1353 | |
| 1354 | v = parseSection("usage:", "usage: prog") |
| 1355 | w = []string{"usage: prog"} |
| 1356 | if reflect.DeepEqual(v, w) != true { |
| 1357 | t.Fail() |
| 1358 | } |
| 1359 | |
| 1360 | v = parseSection("usage:", "usage: -x\n -y") |
| 1361 | w = []string{"usage: -x\n -y"} |
| 1362 | if reflect.DeepEqual(v, w) != true { |
| 1363 | t.Fail() |
| 1364 | } |
| 1365 | |
| 1366 | usage := `usage: this |
| 1367 | |
| 1368 | usage:hai |
| 1369 | usage: this that |
| 1370 | |
| 1371 | usage: foo |
| 1372 | bar |
| 1373 | |
| 1374 | PROGRAM USAGE: |
| 1375 | foo |
| 1376 | bar |
| 1377 | usage: |
| 1378 | ` + "\t" + `too |
| 1379 | ` + "\t" + `tar |
| 1380 | Usage: eggs spam |
| 1381 | BAZZ |
| 1382 | usage: pit stop` |
| 1383 | |
| 1384 | v = parseSection("usage:", usage) |
| 1385 | w = []string{"usage: this", |
| 1386 | "usage:hai", |
| 1387 | "usage: this that", |
| 1388 | "usage: foo\n bar", |
| 1389 | "PROGRAM USAGE:\n foo\n bar", |
| 1390 | "usage:\n\ttoo\n\ttar", |
| 1391 | "Usage: eggs spam", |
| 1392 | "usage: pit stop", |
| 1393 | } |
| 1394 | if reflect.DeepEqual(v, w) != true { |
| 1395 | t.Fail() |
| 1396 | } |
| 1397 | } |
| 1398 | |
| 1399 | func TestIssue126DefaultsNotParsedCorrectlyWhenTabs(t *testing.T) { |
| 1400 | section := "Options:\n\t--foo=<arg> [default: bar]" |
nothing calls this directly
no test coverage detected