mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
add a helper to search a list for a pattern
This commit is contained in:
parent
75ba2196ba
commit
fb156bcaac
@ -3,6 +3,7 @@ package test
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -43,3 +44,15 @@ func CreateMockCommand(t *testing.T, swappers []*CommandSwapper) func(cmd string
|
|||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AssertContainsMatch(t *testing.T, strs []string, pattern *regexp.Regexp, message string) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
for _, str := range strs {
|
||||||
|
if pattern.Match([]byte(str)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Fail(t, message)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user