diff options
Diffstat (limited to 'pkg/gui/mergeconflicts/find_conflicts_test.go')
-rw-r--r-- | pkg/gui/mergeconflicts/find_conflicts_test.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/pkg/gui/mergeconflicts/find_conflicts_test.go b/pkg/gui/mergeconflicts/find_conflicts_test.go new file mode 100644 index 000000000..c0a8e3e5b --- /dev/null +++ b/pkg/gui/mergeconflicts/find_conflicts_test.go @@ -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)) + } +} |