Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hivesim: make test matching case insensitive #689

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
}