mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-15 19:31:47 +02:00
tests for mark related tokens
This commit is contained in:
vim-engine/src/test/kotlin/com/maddyhome/idea/vim/regexp
@@ -70,8 +70,8 @@ internal object VimRegexTestUtils {
|
||||
}
|
||||
|
||||
if (carets.isEmpty()) {
|
||||
// if no carets are provided, place on at the start of the text
|
||||
val caret = mockCaret(0, Pair(-1, -1), emptyMap())
|
||||
// if no carets are provided, place one at the start of the text
|
||||
val caret = mockCaret(0, Pair(visualStart, visualEnd), marks)
|
||||
whenever(editorMock.carets()).thenReturn(listOf(caret))
|
||||
whenever(editorMock.currentCaret()).thenReturn(caret)
|
||||
} else {
|
||||
|
@@ -12,6 +12,7 @@ import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.mockEditorFromText
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.CARET
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.START
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.END
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.MARK
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.VISUAL_END
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.VISUAL_START
|
||||
import com.maddyhome.idea.vim.regexp.VimRegexTestUtils.getMatchRanges
|
||||
@@ -1671,6 +1672,38 @@ class NFATest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test text at mark position`() {
|
||||
doTest(
|
||||
"Lorem ${START}${MARK('m')}Ips${END}um",
|
||||
"\\%'m..."
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test text before mark position`() {
|
||||
doTest(
|
||||
"${START}Lor${END}em ${MARK('m')}Ipsum",
|
||||
"\\%<'m..."
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test text after mark position`() {
|
||||
doTest(
|
||||
"Lorem ${MARK('m')}I${START}psu${END}m",
|
||||
"\\%>'m..."
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test mark does not exist`() {
|
||||
assertFailure(
|
||||
"Lorem ${MARK('m')}Ipsum",
|
||||
"\\%'n..."
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private fun assertFailure(
|
||||
text: CharSequence,
|
||||
|
Reference in New Issue
Block a user