1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

add a helper to search a list for a pattern

This commit is contained in:
Chris Taylor 2020-02-01 17:10:02 -05:00 committed by Jesse Duffield
parent 75ba2196ba
commit fb156bcaac

View File

@ -3,6 +3,7 @@ package test
import (
"fmt"
"os/exec"
"regexp"
"strings"
"testing"
@ -43,3 +44,15 @@ func CreateMockCommand(t *testing.T, swappers []*CommandSwapper) func(cmd string
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)
}