(t *testing.T)
| 522 | } |
| 523 | |
| 524 | func TestOptionalMatch(t *testing.T) { |
| 525 | v, w, x := newOptional(newOption("-a", "", 0, false)).match( |
| 526 | &patternList{newOption("-a", "", 0, false)}, nil) |
| 527 | y := patternList{newOption("-a", "", 0, false)} |
| 528 | if v != true || |
| 529 | reflect.DeepEqual(*w, patternList{}) != true || |
| 530 | reflect.DeepEqual(*x, y) != true { |
| 531 | t.Fail() |
| 532 | } |
| 533 | |
| 534 | v, w, x = newOptional(newOption("-a", "", 0, false)).match( |
| 535 | &patternList{}, nil) |
| 536 | if v != true || |
| 537 | reflect.DeepEqual(*w, patternList{}) != true || |
| 538 | reflect.DeepEqual(*x, patternList{}) != true { |
| 539 | t.Fail() |
| 540 | } |
| 541 | |
| 542 | v, w, x = newOptional(newOption("-a", "", 0, false)).match( |
| 543 | &patternList{newOption("-x", "", 0, false)}, nil) |
| 544 | y = patternList{newOption("-x", "", 0, false)} |
| 545 | if v != true || |
| 546 | reflect.DeepEqual(*w, y) != true || |
| 547 | reflect.DeepEqual(*x, patternList{}) != true { |
| 548 | t.Fail() |
| 549 | } |
| 550 | |
| 551 | v, w, x = newOptional(newOption("-a", "", 0, false), |
| 552 | newOption("-b", "", 0, false)).match( |
| 553 | &patternList{newOption("-a", "", 0, false)}, nil) |
| 554 | y = patternList{newOption("-a", "", 0, false)} |
| 555 | if v != true || |
| 556 | reflect.DeepEqual(*w, patternList{}) != true || |
| 557 | reflect.DeepEqual(*x, y) != true { |
| 558 | t.Fail() |
| 559 | } |
| 560 | |
| 561 | v, w, x = newOptional(newOption("-a", "", 0, false), |
| 562 | newOption("-b", "", 0, false)).match( |
| 563 | &patternList{newOption("-b", "", 0, false)}, nil) |
| 564 | y = patternList{newOption("-b", "", 0, false)} |
| 565 | if v != true || |
| 566 | reflect.DeepEqual(*w, patternList{}) != true || |
| 567 | reflect.DeepEqual(*x, y) != true { |
| 568 | t.Fail() |
| 569 | } |
| 570 | |
| 571 | v, w, x = newOptional(newOption("-a", "", 0, false), |
| 572 | newOption("-b", "", 0, false)).match( |
| 573 | &patternList{newOption("-x", "", 0, false)}, nil) |
| 574 | y = patternList{newOption("-x", "", 0, false)} |
| 575 | if v != true || |
| 576 | reflect.DeepEqual(*w, y) != true || |
| 577 | reflect.DeepEqual(*x, patternList{}) != true { |
| 578 | t.Fail() |
| 579 | } |
| 580 | |
| 581 | v, w, x = newOptional(newArgument("N", nil)).match( |
nothing calls this directly
no test coverage detected