1package soy.iko.opencode.ui.components
3import org.junit.Assert.assertEquals
4import org.junit.Assert.assertFalse
5import org.junit.Assert.assertTrue
11 fun parsesAddedRemovedContextAndHunks() {
21 val lines = parseDiff(diff)
22 assertEquals(6, lines.size)
23 assertTrue(lines[0] is DiffLine.FileHeader) // ---
24 assertTrue(lines[1] is DiffLine.FileHeader) // +++
25 assertTrue(lines[2] is DiffLine.Hunk) // @@
26 assertTrue(lines[3] is DiffLine.Context)
27 assertTrue(lines[4] is DiffLine.Remove)
28 assertEquals("removed line", (lines[4] as DiffLine.Remove).text)
29 assertTrue(lines[5] is DiffLine.Add)
30 assertEquals("added line", (lines[5] as DiffLine.Add).text)
34 fun stripsPrefixFromAddAndRemove() {
35 val lines = parseDiff("-gone\n+new")
36 assertEquals("gone", (lines[0] as DiffLine.Remove).text)
37 assertEquals("new", (lines[1] as DiffLine.Add).text)
41 fun looksLikeDiffTrueForUnifiedDiff() {
42 assertTrue(looksLikeDiff("@@ -1,1 +1,1 @@\n-old\n+new"))
46 fun looksLikeDiffFalseForPlainText() {
47 assertFalse(looksLikeDiff("This is just some prose.\nNo diff here."))
48 assertFalse(looksLikeDiff(""))
52 fun emptyInputParsesToEmpty() {
53 assertTrue(parseDiff("").isEmpty())
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list