Skip to content

Commit 24488d7

Browse files
authored
Only split on the first / when splitting the test name (exercism#138)
1 parent cda25a3 commit 24488d7

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

testrunner/extract.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ import (
1111
// Split a test name into its constituent parts
1212
// https://blog.golang.org/subtests#:~:text=The%20full%20name%20of%20a,first%20argument%20to%20Run%20otherwise.
1313
func splitTestName(testName string) (string, string) {
14-
t := strings.Split(testName, "/")
15-
if len(t) == 1 {
16-
return t[0], ""
17-
}
18-
return t[0], t[1]
14+
before, after, _ := strings.Cut(testName, "/")
15+
return before, after
1916
}
2017

2118
func FindTestFile(codePath string) string {

0 commit comments

Comments
 (0)