Skip to content

Commit

Permalink
make test coverage to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
rueyaa332266 committed Jul 27, 2020
1 parent af53859 commit 2d4622b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions multiregexp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@ package multiregexp
import (
"fmt"
"regexp"
"testing"
)

func TestMatch_withAndLogic(t *testing.T) {
regs := Regexps{regexp.MustCompile(`[A-z]`), regexp.MustCompile(`[a-z]`)}
got := regs.Match([]byte("Foo"), "AND")
if got != true {
t.Errorf("Error in Match AND")
}
}

func TestMatch_withOrLogic(t *testing.T) {
regs := Regexps{regexp.MustCompile(`[A-z]`), regexp.MustCompile(`[a-z]`)}
got := regs.Match([]byte("123"))
if got != false {
t.Errorf("Error in Match OR")
}
}

func ExampleRegexps_Match_withAndLogic() {
var regs Regexps

Expand Down Expand Up @@ -41,6 +58,22 @@ func ExampleRegexps_MatchWhich() {
// Output: [1]
}

func TestMatchString_withAndLogic(t *testing.T) {
regs := Regexps{regexp.MustCompile(`[A-z]`), regexp.MustCompile(`[a-z]`)}
got := regs.MatchString("Foo", "AND")
if got != true {
t.Errorf("Error in MatchString AND")
}
}

func TestMatchString_withOrLogic(t *testing.T) {
regs := Regexps{regexp.MustCompile(`[A-z]`), regexp.MustCompile(`[a-z]`)}
got := regs.MatchString("123")
if got != false {
t.Errorf("Error in MatchString OR")
}
}

func ExampleRegexps_MatchString_withAndLogic() {
var regs Regexps

Expand Down

0 comments on commit 2d4622b

Please sign in to comment.