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

62 lines
956 B
Go
Raw Normal View History

2021-05-30 07:22:04 +02:00
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,
2021-05-30 07:22:04 +02:00
},
{
line: ">>>>>>> blah",
expected: END,
},
{
line: "||||||| adf33b9",
expected: ANCESTOR,
},
2021-05-30 07:22:04 +02:00
}
for _, s := range scenarios {
assert.EqualValues(t, s.expected, determineLineType(s.line))
}
}