diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-05-30 15:22:04 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-02 20:33:52 +1000 |
commit | 258eedb38c6e8692565d74a92e3590da477dea6b (patch) | |
tree | db0a544b281184b04c704182e5a81f11172ee80e /pkg/gui/mergeconflicts/find_conflicts_test.go | |
parent | bc044c64b2315c3fb8c523fa0ae7ef71bcba3b31 (diff) |
refactor
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)) + } +} |