(t *testing.T)
| 704 | } |
| 705 | |
| 706 | func TestOneOrMoreMatch(t *testing.T) { |
| 707 | v, w, x := newOneOrMore(newArgument("N", nil)).match( |
| 708 | &patternList{newArgument("", 9)}, nil) |
| 709 | y := patternList{newArgument("N", 9)} |
| 710 | if v != true || |
| 711 | reflect.DeepEqual(*w, patternList{}) != true || |
| 712 | reflect.DeepEqual(*x, y) != true { |
| 713 | t.Fail() |
| 714 | } |
| 715 | |
| 716 | v, w, x = newOneOrMore(newArgument("N", nil)).match( |
| 717 | &patternList{}, nil) |
| 718 | y = patternList{} |
| 719 | z := patternList{} |
| 720 | if v != false || |
| 721 | reflect.DeepEqual(*w, y) != true || |
| 722 | reflect.DeepEqual(*x, z) != true { |
| 723 | t.Fail() |
| 724 | } |
| 725 | |
| 726 | v, w, x = newOneOrMore(newArgument("N", nil)).match( |
| 727 | &patternList{newOption("-x", "", 0, false)}, nil) |
| 728 | y = patternList{newOption("-x", "", 0, false)} |
| 729 | z = patternList{} |
| 730 | if v != false || |
| 731 | reflect.DeepEqual(*w, y) != true || |
| 732 | reflect.DeepEqual(*x, z) != true { |
| 733 | t.Fail() |
| 734 | } |
| 735 | |
| 736 | v, w, x = newOneOrMore(newArgument("N", nil)).match( |
| 737 | &patternList{newArgument("", 9), newArgument("", 8)}, nil) |
| 738 | y = patternList{} |
| 739 | z = patternList{newArgument("N", 9), newArgument("N", 8)} |
| 740 | if v != true || |
| 741 | reflect.DeepEqual(*w, y) != true || |
| 742 | reflect.DeepEqual(*x, z) != true { |
| 743 | t.Fail() |
| 744 | } |
| 745 | |
| 746 | v, w, x = newOneOrMore(newArgument("N", nil)).match(&patternList{ |
| 747 | newArgument("", 9), |
| 748 | newOption("-x", "", 0, false), |
| 749 | newArgument("", 8)}, nil) |
| 750 | y = patternList{newOption("-x", "", 0, false)} |
| 751 | z = patternList{newArgument("N", 9), newArgument("N", 8)} |
| 752 | if v != true || |
| 753 | reflect.DeepEqual(*w, y) != true || |
| 754 | reflect.DeepEqual(*x, z) != true { |
| 755 | t.Fail() |
| 756 | } |
| 757 | |
| 758 | v, w, x = newOneOrMore(newOption("-a", "", 0, false)).match(&patternList{ |
| 759 | newOption("-a", "", 0, false), |
| 760 | newArgument("", 8), |
| 761 | newOption("-a", "", 0, false)}, nil) |
| 762 | y = patternList{newArgument("", 8)} |
| 763 | z = patternList{newOption("-a", "", 0, false), newOption("-a", "", 0, false)} |
nothing calls this directly
no test coverage detected