Skip to content

Commit

Permalink
hivesim: make test matching case insensitive (ethereum#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored and Rjected committed Feb 7, 2023
1 parent 019e863 commit 8b09874
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hivesim/testmatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ type testMatcher struct {

func parseTestPattern(p string) (m testMatcher, err error) {
parts := splitRegexp(p)
m.suite, err = regexp.Compile(parts[0])
m.suite, err = regexp.Compile("(?i:" + parts[0] + ")")
if err != nil {
return m, err
}
if len(parts) > 1 {
m.test, err = regexp.Compile(strings.Join(parts[1:], "/"))
m.test, err = regexp.Compile("(?i:" + strings.Join(parts[1:], "/") + ")")
if err != nil {
return m, err
}
Expand Down
25 changes: 25 additions & 0 deletions hivesim/testmatch_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package hivesim

import (
"testing"
)

func TestMatch(t *testing.T) {
tm, err := parseTestPattern("sim/test")
if err != nil {
t.Fatal(err)
}

if !tm.match("sim", "test") {
t.Fatal("expected match")
}
if !tm.match("Sim", "Test") {
t.Fatal("expected match")
}
if !tm.match("Sim", "TestTest") {
t.Fatal("expected match")
}
if tm.match("Sim", "Tst") {
t.Fatal("expected no match")
}
}

0 comments on commit 8b09874

Please sign in to comment.