Skip to content

Commit

Permalink
Correct test suite to handle changes where cursor inside of range
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritsuku committed Sep 15, 2014
1 parent 960a9f8 commit 441a1e8
Showing 1 changed file with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ class EditorUtilsTest {
m
else {
val close = input.indexOf(']', open+1)
val s = (m.size)*2
val s = m.size*2
if (open < selStart)
findBraces(close, m + ((open-s, close-s-1)))
else if (close < selEnd)
findBraces(close, m + ((open-s-1, close-s-1)))
if (close < selEnd)
findBraces(close, m + ((open-s, close-s-1)))
else
findBraces(close, m + ((open-s, close-s-2)))
else
findBraces(close, m + ((open-s-1, close-s-2)))
}
Expand Down Expand Up @@ -367,4 +368,30 @@ class EditorUtilsTest {
| def f = 0+1^
|}
|""".stripMargin after Seq("def g = 0", "+1")

@Test
def remove_after_cursor_with_cursor_inside_of_range() = """|
|class X {
| def f = 0[ ^ ]
| [def g = 0]
|}
|""".stripMargin becomes """|
|class X {
| def f = 0^
| $
|}
|""".stripMargin after Seq("", "")

@Test
def remove_before_cursor_with_cursor_inside_of_range() = """|
|class X {
| [def g = 0]
| def f = 0[ ^ ]
|}
|""".stripMargin becomes """|
|class X {
| $
| def f = 0^
|}
|""".stripMargin after Seq("", "")
}

0 comments on commit 441a1e8

Please sign in to comment.