1
0
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:
Emanuel Gestosa
2023-09-13 14:34:53 +01:00
committed by lippfi
parent a30c94fd2f
commit 3afb00d563
2 changed files with 35 additions and 2 deletions
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,