1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-04 07:34:03 +02:00

Add some tests for one time mode

This commit is contained in:
Alex Plate 2023-11-24 17:49:04 +02:00
parent 568d5ca4ff
commit 336efa1e8b
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
2 changed files with 28 additions and 4 deletions
annotation-processors/src/main/kotlin/com/intellij/vim/annotations
src/test/java/org/jetbrains/plugins/ideavim/action/change/insert

View File

@ -44,7 +44,7 @@ enum class Mode(val abbrev: Char) {
OP_PENDING('O'),
/**
* Indicates this key mapping applies to Insert mode
* Indicates this key mapping applies to Insert or Replace modes
*/
INSERT('I'),

View File

@ -12,14 +12,38 @@ import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test
class InsertSingleCommandActionTest : VimTestCase() {
class InsertSingleCommandActionTest : SingleCommandActionTest() {
override val command: String = "i"
override val mode: Mode = Mode.INSERT
}
class ReplaceSingleCommandActionTest : SingleCommandActionTest() {
override val command: String = "R"
override val mode: Mode = Mode.REPLACE
}
abstract class SingleCommandActionTest : VimTestCase() {
abstract val command: String
abstract val mode: Mode
@Test
fun `one operation`() {
doTest(
listOf(command, "<C-O>", "l"),
"I found ${c}it in a legendary land",
"I found i${c}t in a legendary land",
mode,
)
}
@Test
fun `test enter visual`() {
doTest(
listOf("i", "<C-O>", "vlll", "<Esc>"),
listOf(command, "<C-O>", "vlll", "<Esc>"),
"I found ${c}it in a legendary land",
"I found it ${c}in a legendary land",
Mode.INSERT,
mode,
)
}
}