mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
refactor
This commit is contained in:
57
pkg/gui/mergeconflicts/find_conflicts_test.go
Normal file
57
pkg/gui/mergeconflicts/find_conflicts_test.go
Normal file
@ -0,0 +1,57 @@
|
||||
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: MIDDLE,
|
||||
},
|
||||
{
|
||||
line: ">>>>>>> blah",
|
||||
expected: END,
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
assert.EqualValues(t, s.expected, determineLineType(s.line))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user