1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

refactor to not have Match at the start of assert method names, because it reads better that way

This commit is contained in:
Jesse Duffield
2022-12-24 17:01:26 +11:00
parent c19f52255c
commit aedfce2845
36 changed files with 208 additions and 208 deletions

View File

@ -115,7 +115,7 @@ func (self *Assert) AtLeastOneCommit() {
})
}
func (self *Assert) MatchHeadCommitMessage(matcher *matcher) {
func (self *Assert) HeadCommitMessage(matcher *matcher) {
self.assertWithRetries(func() (bool, string) {
return len(self.gui.Model().Commits) > 0, "Expected at least one commit to be present"
})
@ -156,7 +156,7 @@ func (self *Assert) InListContext() {
})
}
func (self *Assert) MatchSelectedLine(matcher *matcher) {
func (self *Assert) SelectedLine(matcher *matcher) {
self.matchString(matcher, "Unexpected selected line.",
func() string {
return self.gui.CurrentContext().GetView().SelectedLine()
@ -199,7 +199,7 @@ func (self *Assert) NotInPopup() {
})
}
func (self *Assert) MatchCurrentViewTitle(matcher *matcher) {
func (self *Assert) CurrentViewTitle(matcher *matcher) {
self.matchString(matcher, "Unexpected current view title.",
func() string {
return self.gui.CurrentContext().GetView().Title
@ -207,7 +207,7 @@ func (self *Assert) MatchCurrentViewTitle(matcher *matcher) {
)
}
func (self *Assert) MatchViewContent(viewName string, matcher *matcher) {
func (self *Assert) ViewContent(viewName string, matcher *matcher) {
self.matchString(matcher, fmt.Sprintf("Unexpected content in view '%s'.", viewName),
func() string {
return self.gui.View(viewName).Buffer()
@ -215,7 +215,7 @@ func (self *Assert) MatchViewContent(viewName string, matcher *matcher) {
)
}
func (self *Assert) MatchCurrentViewContent(matcher *matcher) {
func (self *Assert) CurrentViewContent(matcher *matcher) {
self.matchString(matcher, "Unexpected content in current view.",
func() string {
return self.gui.CurrentContext().GetView().Buffer()
@ -223,7 +223,7 @@ func (self *Assert) MatchCurrentViewContent(matcher *matcher) {
)
}
func (self *Assert) MatchMainViewContent(matcher *matcher) {
func (self *Assert) MainViewContent(matcher *matcher) {
self.matchString(matcher, "Unexpected main view content.",
func() string {
return self.gui.MainView().Buffer()
@ -231,7 +231,7 @@ func (self *Assert) MatchMainViewContent(matcher *matcher) {
)
}
func (self *Assert) MatchSecondaryViewContent(matcher *matcher) {
func (self *Assert) SecondaryViewContent(matcher *matcher) {
self.matchString(matcher, "Unexpected secondary view title.",
func() string {
return self.gui.SecondaryView().Buffer()

View File

@ -78,7 +78,7 @@ func (self *Input) Confirm() {
func (self *Input) ProceedWhenAsked(matcher *matcher) {
self.assert.InConfirm()
self.assert.MatchCurrentViewContent(matcher)
self.assert.CurrentViewContent(matcher)
self.Confirm()
}
@ -109,7 +109,7 @@ func (self *Input) PreviousItem() {
func (self *Input) ContinueMerge() {
self.PressKeys(self.keys.Universal.CreateRebaseOptionsMenu)
self.assert.MatchSelectedLine(Contains("continue"))
self.assert.SelectedLine(Contains("continue"))
self.Confirm()
}
@ -171,20 +171,20 @@ func (self *Input) NavigateToListItemContainingText(text string) {
selectedLineIdx := view.SelectedLineIdx()
if selectedLineIdx == matchIndex {
self.assert.MatchSelectedLine(Contains(text))
self.assert.SelectedLine(Contains(text))
return
}
if selectedLineIdx < matchIndex {
for i := selectedLineIdx; i < matchIndex; i++ {
self.NextItem()
}
self.assert.MatchSelectedLine(Contains(text))
self.assert.SelectedLine(Contains(text))
return
} else {
for i := selectedLineIdx; i > matchIndex; i-- {
self.PreviousItem()
}
self.assert.MatchSelectedLine(Contains(text))
self.assert.SelectedLine(Contains(text))
return
}
}