1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-13 01:30:53 +02:00

add multi-line commit integration test

This commit is contained in:
Jesse Duffield
2022-12-20 22:18:26 +11:00
parent abbd598992
commit b40190bd94
44 changed files with 54 additions and 49 deletions

View File

@ -2,6 +2,7 @@ package components
import (
"fmt"
"regexp"
"strings"
"time"
@ -56,6 +57,16 @@ func NotContains(target string) *matcher {
}}
}
func MatchesRegexp(regexStr string) *matcher {
return &matcher{testFn: func(value string) (bool, string) {
matched, err := regexp.MatchString(regexStr, value)
if err != nil {
return false, fmt.Sprintf("Unexpected error parsing regular expression '%s': %s", regexStr, err.Error())
}
return matched, fmt.Sprintf("Expected '%s' to match regular expression '%s'", value, regexStr)
}}
}
func Equals(target string) *matcher {
return &matcher{testFn: func(value string) (bool, string) {
return target == value, fmt.Sprintf("Expected '%s' to equal '%s'", value, target)