1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/mergeconflicts/find_conflicts_test.go
2021-08-25 22:23:55 +10:00

62 lines
956 B
Go

package mergeconflicts
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDetermineLineType(t *testing.T) {
type scenario struct {
line string
expected LineType
}
scenarios := []scenario{
{
line: "",
expected: NOT_A_MARKER,
},
{
line: "blah",
expected: NOT_A_MARKER,
},
{
line: "<<<<<<< HEAD",
expected: START,
},
{
line: "<<<<<<< HEAD:my_branch",
expected: START,
},
{
line: "<<<<<<< MERGE_HEAD:my_branch",
expected: START,
},
{
line: "<<<<<<< Updated upstream:my_branch",
expected: START,
},
{
line: "<<<<<<< ours:my_branch",
expected: START,
},
{
line: "=======",
expected: TARGET,
},
{
line: ">>>>>>> blah",
expected: END,
},
{
line: "||||||| adf33b9",
expected: ANCESTOR,
},
}
for _, s := range scenarios {
assert.EqualValues(t, s.expected, determineLineType(s.line))
}
}