1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-09 01:17:06 +02:00

add bisect integration test

This commit is contained in:
Jesse Duffield
2022-08-22 19:34:02 +10:00
parent 79620fc6cf
commit 010f430d1f
141 changed files with 169 additions and 114 deletions

View File

@ -46,7 +46,13 @@ func (self *matcher) context(prefix string) *matcher {
func Contains(target string) *matcher {
return &matcher{testFn: func(value string) (bool, string) {
return strings.Contains(value, target), fmt.Sprintf("Expected '%s' to contain '%s'", value, target)
return strings.Contains(value, target), fmt.Sprintf("Expected '%s' to be found in '%s'", target, value)
}}
}
func NotContains(target string) *matcher {
return &matcher{testFn: func(value string) (bool, string) {
return !strings.Contains(value, target), fmt.Sprintf("Expected '%s' to NOT be found in '%s'", target, value)
}}
}
@ -164,6 +170,22 @@ func (self *Assert) MatchCurrentViewTitle(matcher *matcher) {
)
}
func (self *Assert) MatchViewContent(viewName string, matcher *matcher) {
self.matchString(matcher, fmt.Sprintf("Unexpected content in view '%s'.", viewName),
func() string {
return self.gui.View(viewName).Buffer()
},
)
}
func (self *Assert) MatchCurrentViewContent(matcher *matcher) {
self.matchString(matcher, "Unexpected content in current view.",
func() string {
return self.gui.CurrentContext().GetView().Buffer()
},
)
}
func (self *Assert) MatchMainViewContent(matcher *matcher) {
self.matchString(matcher, "Unexpected main view content.",
func() string {