Skip to content

Commit

Permalink
refactor: adjust row logging in LogRemainingOutput to handle initial …
Browse files Browse the repository at this point in the history
…state correctly
  • Loading branch information
ryan-gang committed Dec 13, 2024
1 parent 34a61df commit 58aa188
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/logged_shell_asserter/logged_shell_asserter.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (a *LoggedShellAsserter) logAssertionError(err assertions.AssertionError) {
}

func (a *LoggedShellAsserter) LogRemainingOutput() {
// if we ever call this, before logging anything
// a.lastLoggedRowIndex would be -1, we want it to be 0
startRowIndex := max(0, a.lastLoggedRowIndex)
endRowIndex := len(a.Shell.GetScreenState())
a.logRows(a.lastLoggedRowIndex, endRowIndex)
a.logRows(startRowIndex, endRowIndex)
}

func (a *LoggedShellAsserter) logRows(startRowIndex int, endRowIndex int) {
Expand Down

0 comments on commit 58aa188

Please sign in to comment.