1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-06-02 22:34:08 +02:00

Code cleanup

This commit is contained in:
Alex Plate 2023-03-16 13:05:37 +02:00
parent edf9962abf
commit e30e194b91
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
35 changed files with 271 additions and 237 deletions

View File

@ -14,7 +14,6 @@ import com.ensarsarajcic.neovim.java.api.types.api.VimCoords
import com.ensarsarajcic.neovim.java.corerpc.client.ProcessRpcConnection import com.ensarsarajcic.neovim.java.corerpc.client.ProcessRpcConnection
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.LogicalPosition import com.intellij.openapi.editor.LogicalPosition
import com.intellij.util.containers.toArray
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.SelectionType import com.maddyhome.idea.vim.command.SelectionType
import com.maddyhome.idea.vim.common.CharacterPosition import com.maddyhome.idea.vim.common.CharacterPosition
@ -31,7 +30,6 @@ import com.maddyhome.idea.vim.register.RegisterConstants.LAST_SEARCH_REGISTER
import com.maddyhome.idea.vim.register.RegisterConstants.VALID_REGISTERS import com.maddyhome.idea.vim.register.RegisterConstants.VALID_REGISTERS
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.jupiter.api.TestInfo import org.junit.jupiter.api.TestInfo
import org.junit.jupiter.params.provider.Arguments
internal object NeovimTesting { internal object NeovimTesting {
private lateinit var neovimApi: NeovimApi private lateinit var neovimApi: NeovimApi

View File

@ -10,9 +10,9 @@ package org.jetbrains.plugins.ideavim.action
import com.google.common.collect.Lists import com.google.common.collect.Lists
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class ChangeNumberActionTest : VimTestCase() { class ChangeNumberActionTest : VimTestCase() {

View File

@ -13,7 +13,6 @@ import com.maddyhome.idea.vim.register.RegisterConstants.LAST_INSERTED_TEXT_REGI
import com.maddyhome.idea.vim.register.RegisterConstants.LAST_SEARCH_REGISTER import com.maddyhome.idea.vim.register.RegisterConstants.LAST_SEARCH_REGISTER
import com.maddyhome.idea.vim.register.RegisterConstants.SMALL_DELETION_REGISTER import com.maddyhome.idea.vim.register.RegisterConstants.SMALL_DELETION_REGISTER
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.Assert
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInfo import org.junit.jupiter.api.TestInfo
@ -200,7 +199,7 @@ class SpecialRegistersTest : VimTestCase() {
private fun assertRegisterChanged(registerName: Char) { private fun assertRegisterChanged(registerName: Char) {
val registerText = getRegisterText(registerName) val registerText = getRegisterText(registerName)
Assert.assertNotEquals(DUMMY_TEXT, registerText) assertNotEquals(DUMMY_TEXT, registerText)
} }
private fun assertRegisterNotChanged(registerName: Char) { private fun assertRegisterNotChanged(registerName: Char) {

View File

@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.group.IjOptionConstants import com.maddyhome.idea.vim.group.IjOptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions @TraceOptions
class DeleteJoinLinesSpacesActionTest : VimTestCase() { class DeleteJoinLinesSpacesActionTest : VimTestCase() {

View File

@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.group.IjOptionConstants import com.maddyhome.idea.vim.group.IjOptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions @TraceOptions
class DeleteJoinVisualLinesSpacesActionTest : VimTestCase() { class DeleteJoinVisualLinesSpacesActionTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.virtualedit) @TraceOptions(OptionConstants.virtualedit)
class DeleteVisualLinesEndActionTest : VimTestCase() { class DeleteVisualLinesEndActionTest : VimTestCase() {
@ -659,7 +659,8 @@ class DeleteVisualLinesEndActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore])) fun `test change dollar`() { @OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore]))
fun `test change dollar`() {
doTest( doTest(
"c$", "c$",
""" """

View File

@ -16,10 +16,10 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.IjOptionConstants import com.maddyhome.idea.vim.group.IjOptionConstants
import com.maddyhome.idea.vim.group.NotificationService import com.maddyhome.idea.vim.group.NotificationService
import org.jetbrains.plugins.ideavim.impl.VimOption import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.impl.VimOption
/** /**
* @author Alex Plate * @author Alex Plate

View File

@ -16,10 +16,10 @@ import com.maddyhome.idea.vim.command.SelectionType
import com.maddyhome.idea.vim.group.NotificationService import com.maddyhome.idea.vim.group.NotificationService
import com.maddyhome.idea.vim.newapi.vim import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.rangeOf import org.jetbrains.plugins.ideavim.rangeOf
@TraceOptions(OptionConstants.clipboard) @TraceOptions(OptionConstants.clipboard)

View File

@ -10,10 +10,10 @@ package org.jetbrains.plugins.ideavim.action.copy
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.clipboard) @TraceOptions(OptionConstants.clipboard)
class YankAndPutTest : VimTestCase() { class YankAndPutTest : VimTestCase() {

View File

@ -13,12 +13,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class MotionArrowLeftActionTest : VimTestCase() { class MotionArrowLeftActionTest : VimTestCase() {

View File

@ -13,12 +13,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class MotionArrowRightActionTest : VimTestCase() { class MotionArrowRightActionTest : VimTestCase() {
@ -236,8 +236,8 @@ class MotionArrowRightActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect]))
fun `test visual stopselect`() { fun `test visual stopselect`() {
doTest( doTest(
listOf("v", "<Right>"), listOf("v", "<Right>"),
""" """

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class MotionEndActionTest : VimTestCase() { class MotionEndActionTest : VimTestCase() {
@ -45,7 +45,7 @@ class MotionEndActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""]))
fun `test continue visual`() { fun `test continue visual`() {
val keys = listOf("v", "<End>") val keys = listOf("v", "<End>")
val before = """ val before = """
@ -68,7 +68,7 @@ class MotionEndActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""]))
fun `test continue select`() { fun `test continue select`() {
val keys = listOf("gh", "<End>") val keys = listOf("gh", "<End>")
val before = """ val before = """
@ -91,7 +91,8 @@ class MotionEndActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopvisual])) fun `test exit visual`() { @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopvisual]))
fun `test exit visual`() {
val keys = listOf("v", "<End>") val keys = listOf("v", "<End>")
val before = """ val before = """
A Discovery A Discovery
@ -113,7 +114,7 @@ class MotionEndActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect]))
fun `test exit select`() { fun `test exit select`() {
val keys = listOf("gh", "<End>") val keys = listOf("gh", "<End>")
val before = """ val before = """

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class MotionHomeActionTest : VimTestCase() { class MotionHomeActionTest : VimTestCase() {
@ -51,7 +51,7 @@ class MotionHomeActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""]))
fun `test continue visual`() { fun `test continue visual`() {
val keys = listOf("v", "<Home>") val keys = listOf("v", "<Home>")
val before = """ val before = """
@ -74,7 +74,7 @@ class MotionHomeActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [""]))
fun `test continue select`() { fun `test continue select`() {
val keys = listOf("gh", "<Home>") val keys = listOf("gh", "<Home>")
val before = """ val before = """
@ -97,7 +97,8 @@ class MotionHomeActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopvisual])) fun `test exit visual`() { @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopvisual]))
fun `test exit visual`() {
val keys = listOf("v", "<Home>") val keys = listOf("v", "<Home>")
val before = """ val before = """
A Discovery A Discovery
@ -119,7 +120,7 @@ class MotionHomeActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect])) @OptionTest(VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_stopselect]))
fun `test exit select`() { fun `test exit select`() {
val keys = listOf("gh", "<Home>") val keys = listOf("gh", "<Home>")
val before = """ val before = """

View File

@ -12,17 +12,17 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.virtualedit) @TraceOptions(OptionConstants.virtualedit)
class MotionRightActionTest : VimTestCase() { class MotionRightActionTest : VimTestCase() {
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion`() { fun `test simple motion`() {
doTest( doTest(
"l", "l",
""" """
@ -47,7 +47,7 @@ class MotionRightActionTest : VimTestCase() {
} }
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion with repeat`() { fun `test simple motion with repeat`() {
doTest( doTest(
"3l", "3l",
""" """
@ -72,7 +72,7 @@ class MotionRightActionTest : VimTestCase() {
} }
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion to the end`() { fun `test simple motion to the end`() {
doTest( doTest(
"3l", "3l",
""" """
@ -97,7 +97,8 @@ class MotionRightActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore])) fun `test virtual edit motion to the end`() { @OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore]))
fun `test virtual edit motion to the end`() {
doTest( doTest(
"3l", "3l",
""" """
@ -116,7 +117,8 @@ class MotionRightActionTest : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore])) fun `test virtual edit motion after dollar`() { @OptionTest(VimOption(OptionConstants.virtualedit, limitedValues = [OptionConstants.virtualedit_onemore]))
fun `test virtual edit motion after dollar`() {
doTest( doTest(
"\$l", "\$l",
""" """
@ -136,7 +138,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.NON_ASCII) @TestWithoutNeovim(SkipNeovimReason.NON_ASCII)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion non-ascii`() { fun `test simple motion non-ascii`() {
doTest( doTest(
"l", "l",
""" """
@ -162,7 +164,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.NON_ASCII) @TestWithoutNeovim(SkipNeovimReason.NON_ASCII)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion emoji`() { fun `test simple motion emoji`() {
doTest( doTest(
"l", "l",
""" """
@ -188,7 +190,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.NON_ASCII) @TestWithoutNeovim(SkipNeovimReason.NON_ASCII)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion czech`() { fun `test simple motion czech`() {
doTest( doTest(
"l", "l",
""" """
@ -213,7 +215,7 @@ class MotionRightActionTest : VimTestCase() {
} }
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test simple motion tab`() { fun `test simple motion tab`() {
doTest( doTest(
"l", "l",
""" """
@ -238,7 +240,7 @@ class MotionRightActionTest : VimTestCase() {
} }
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test char visual mode`() { fun `test char visual mode`() {
doTest( doTest(
listOf("v", "ll"), listOf("v", "ll"),
""" """
@ -263,7 +265,7 @@ class MotionRightActionTest : VimTestCase() {
} }
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test block visual mode`() { fun `test block visual mode`() {
doTest( doTest(
listOf("<C-V>", "ll"), listOf("<C-V>", "ll"),
""" """
@ -289,7 +291,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test whichwrap in the same line`() { fun `test whichwrap in the same line`() {
doTest( doTest(
listOf("l"), listOf("l"),
""" """
@ -305,7 +307,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test whichwrap at file end`() { fun `test whichwrap at file end`() {
doTest( doTest(
listOf("l"), listOf("l"),
""" """
@ -321,7 +323,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test whichwrap to next line`() { fun `test whichwrap to next line`() {
doTest( doTest(
listOf("l"), listOf("l"),
""" """
@ -339,7 +341,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test from empty line to empty line`() { fun `test from empty line to empty line`() {
doTest( doTest(
listOf("l"), listOf("l"),
""" """
@ -361,7 +363,7 @@ class MotionRightActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true)) @OptionTest(VimOption(OptionConstants.virtualedit, doesntAffectTest = true))
fun `test d command with whichwrap`() { fun `test d command with whichwrap`() {
doTest( doTest(
listOf("dl"), listOf("dl"),
""" """

View File

@ -50,8 +50,8 @@ class MotionShiftEndActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test start visual`() { fun `test start visual`() {
val keys = listOf("<S-End>") val keys = listOf("<S-End>")
@ -76,8 +76,8 @@ class MotionShiftEndActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]), VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]),
) )
fun `test start select`() { fun `test start select`() {
val keys = listOf("<S-End>") val keys = listOf("<S-End>")
@ -101,8 +101,8 @@ class MotionShiftEndActionTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
fun `test continue visual`() { fun `test continue visual`() {
@ -131,8 +131,8 @@ class MotionShiftEndActionTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
fun `test continue select`() { fun `test continue select`() {

View File

@ -13,12 +13,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode) @TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode)
class MotionShiftHomeActionTest : VimTestCase() { class MotionShiftHomeActionTest : VimTestCase() {
@ -59,8 +59,8 @@ class MotionShiftHomeActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test start visual`() { fun `test start visual`() {
val keys = listOf("<S-Home>") val keys = listOf("<S-Home>")
@ -85,8 +85,8 @@ class MotionShiftHomeActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]), VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]),
) )
fun `test start select`() { fun `test start select`() {
val keys = listOf("<S-Home>") val keys = listOf("<S-Home>")
@ -110,8 +110,8 @@ class MotionShiftHomeActionTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
fun `test continue visual`() { fun `test continue visual`() {
@ -140,8 +140,8 @@ class MotionShiftHomeActionTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
fun `test continue select`() { fun `test continue select`() {

View File

@ -12,21 +12,21 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode) @TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode)
class MotionShiftLeftActionHandlerTest : VimTestCase() { class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test visual left`() { fun `test visual left`() {
doTest( doTest(
listOf("<S-Left>"), listOf("<S-Left>"),
""" """
@ -52,10 +52,10 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test visual left twice`() { fun `test visual left twice`() {
doTest( doTest(
listOf("<S-Left><S-Left>"), listOf("<S-Left><S-Left>"),
""" """
@ -81,10 +81,10 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]), VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]),
) )
fun `test select left`() { fun `test select left`() {
doTest( doTest(
listOf("<S-Left>"), listOf("<S-Left>"),
""" """
@ -110,10 +110,10 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_startsel]),
VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]), VimOption(OptionConstants.selectmode, limitedValues = [OptionConstants.selectmode_key]),
) )
fun `test select left twice`() { fun `test select left twice`() {
doTest( doTest(
listOf("<S-Left><S-Left>"), listOf("<S-Left><S-Left>"),
""" """
@ -140,9 +140,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test simple motion char mode`() { fun `test simple motion char mode`() {
doTest( doTest(
listOf("gh", "<S-Left>"), listOf("gh", "<S-Left>"),
""" """
@ -169,9 +169,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test double motion char mode`() { fun `test double motion char mode`() {
doTest( doTest(
listOf("gh", "<S-Left>".repeat(2)), listOf("gh", "<S-Left>".repeat(2)),
""" """
@ -198,9 +198,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test at line start char mode`() { fun `test at line start char mode`() {
doTest( doTest(
listOf("gh", "<S-Left>".repeat(2)), listOf("gh", "<S-Left>".repeat(2)),
""" """
@ -227,9 +227,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test at file start char mode`() { fun `test at file start char mode`() {
doTest( doTest(
listOf("gh", "<S-Left>".repeat(2)), listOf("gh", "<S-Left>".repeat(2)),
""" """
@ -256,9 +256,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test char mode multicaret`() { fun `test char mode multicaret`() {
doTest( doTest(
listOf("gh", "<S-Left>".repeat(2)), listOf("gh", "<S-Left>".repeat(2)),
""" """
@ -285,9 +285,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test simple motion line mode`() { fun `test simple motion line mode`() {
doTest( doTest(
listOf("gH", "<S-Left>"), listOf("gH", "<S-Left>"),
""" """
@ -314,9 +314,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test to line start line mode`() { fun `test to line start line mode`() {
doTest( doTest(
listOf("gH", "<S-Left>".repeat(5)), listOf("gH", "<S-Left>".repeat(5)),
""" """
@ -343,9 +343,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test to file start line mode`() { fun `test to file start line mode`() {
doTest( doTest(
listOf("gH", "<S-Left>".repeat(5)), listOf("gH", "<S-Left>".repeat(5)),
""" """
@ -372,9 +372,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test line mode multicaret`() { fun `test line mode multicaret`() {
doTest( doTest(
listOf("gH", "<S-Left>".repeat(5)), listOf("gH", "<S-Left>".repeat(5)),
""" """
@ -401,9 +401,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test simple motion block mode`() { fun `test simple motion block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Left>"), listOf("g<C-H>", "<S-Left>"),
""" """
@ -430,9 +430,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test twice motion block mode`() { fun `test twice motion block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Left>".repeat(2)), listOf("g<C-H>", "<S-Left>".repeat(2)),
""" """
@ -459,9 +459,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test at line start block mode`() { fun `test at line start block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Left>".repeat(2)), listOf("g<C-H>", "<S-Left>".repeat(2)),
""" """
@ -488,9 +488,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test at file start block mode`() { fun `test at file start block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Left>".repeat(2)), listOf("g<C-H>", "<S-Left>".repeat(2)),
""" """
@ -517,9 +517,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test multiline with empty line block mode`() { fun `test multiline with empty line block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Down>", "<S-Left>".repeat(2)), listOf("g<C-H>", "<S-Down>", "<S-Left>".repeat(2)),
""" """
@ -547,9 +547,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continueselect]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test multiline block mode`() { fun `test multiline block mode`() {
doTest( doTest(
listOf("g<C-H>", "<S-Down>".repeat(2), "<S-Left>".repeat(3)), listOf("g<C-H>", "<S-Down>".repeat(2), "<S-Left>".repeat(3)),
""" """
@ -577,9 +577,9 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continuevisual]), VimOption(OptionConstants.keymodel, limitedValues = [OptionConstants.keymodel_continuevisual]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test continuevisual`() { fun `test continuevisual`() {
doTest( doTest(
listOf("v", "<S-Left>".repeat(3)), listOf("v", "<S-Left>".repeat(3)),
""" """
@ -605,10 +605,10 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test no continueselect`() { fun `test no continueselect`() {
doTest( doTest(
listOf("gh", "<S-Left>".repeat(3)), listOf("gh", "<S-Left>".repeat(3)),
""" """
@ -634,10 +634,10 @@ class MotionShiftLeftActionHandlerTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest( @OptionTest(
VimOption(OptionConstants.keymodel, limitedValues = [""]), VimOption(OptionConstants.keymodel, limitedValues = [""]),
VimOption(OptionConstants.selectmode, limitedValues = [""]), VimOption(OptionConstants.selectmode, limitedValues = [""]),
) )
fun `test no continuevisual`() { fun `test no continuevisual`() {
doTest( doTest(
listOf("v", "<S-Left>".repeat(3)), listOf("v", "<S-Left>".repeat(3)),
""" """

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode) @TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode)
class MotionShiftRightActionHandlerTest : VimTestCase() { class MotionShiftRightActionHandlerTest : VimTestCase() {

View File

@ -15,14 +15,15 @@ import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.IjOptionConstants import com.maddyhome.idea.vim.group.IjOptionConstants
import com.maddyhome.idea.vim.group.createLineBookmark import com.maddyhome.idea.vim.group.createLineBookmark
import com.maddyhome.idea.vim.group.mnemonic import com.maddyhome.idea.vim.group.mnemonic
import org.jetbrains.plugins.ideavim.impl.VimOption import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(IjOptionConstants.ideamarks) @TraceOptions(IjOptionConstants.ideamarks)
class MotionMarkActionTest : VimTestCase() { class MotionMarkActionTest : VimTestCase() {
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test simple add mark`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test simple add mark`() {
val keys = injector.parser.parseKeys("mA") val keys = injector.parser.parseKeys("mA")
val text = """ val text = """
A Discovery A Discovery
@ -37,7 +38,8 @@ class MotionMarkActionTest : VimTestCase() {
checkMarks('A' to 2) checkMarks('A' to 2)
} }
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test simple add multiple marks`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test simple add multiple marks`() {
val keys = injector.parser.parseKeys("mAj" + "mBj" + "mC") val keys = injector.parser.parseKeys("mAj" + "mBj" + "mC")
val text = """ val text = """
A Discovery A Discovery
@ -52,7 +54,8 @@ class MotionMarkActionTest : VimTestCase() {
checkMarks('A' to 2, 'B' to 3, 'C' to 4) checkMarks('A' to 2, 'B' to 3, 'C' to 4)
} }
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test simple add multiple marks on same line`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test simple add multiple marks on same line`() {
val keys = injector.parser.parseKeys("mA" + "mB" + "mC") val keys = injector.parser.parseKeys("mA" + "mB" + "mC")
val text = """ val text = """
A Discovery A Discovery
@ -70,7 +73,8 @@ class MotionMarkActionTest : VimTestCase() {
// checkMarks('A' to 2, 'B' to 2, 'C' to 2) // checkMarks('A' to 2, 'B' to 2, 'C' to 2)
} }
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test move to another line`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test move to another line`() {
val keys = injector.parser.parseKeys("mAjj" + "mA") val keys = injector.parser.parseKeys("mAjj" + "mA")
val text = """ val text = """
A Discovery A Discovery
@ -85,7 +89,8 @@ class MotionMarkActionTest : VimTestCase() {
checkMarks('A' to 4) checkMarks('A' to 4)
} }
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test simple system mark`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test simple system mark`() {
val text = """ val text = """
A Discovery A Discovery
@ -102,7 +107,8 @@ class MotionMarkActionTest : VimTestCase() {
kotlin.test.assertEquals('A', vimMarks.first().key) kotlin.test.assertEquals('A', vimMarks.first().key)
} }
@OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"])) fun `test system mark move to another line`() { @OptionTest(VimOption(IjOptionConstants.ideamarks, limitedValues = ["true"]))
fun `test system mark move to another line`() {
val text = """ val text = """
A Discovery A Discovery

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.select.motion
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class SelectMotionLeftActionTest : VimTestCase() { class SelectMotionLeftActionTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.select.motion
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class SelectMotionRightActionTest : VimTestCase() { class SelectMotionRightActionTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel, OptionConstants.virtualedit) @TraceOptions(OptionConstants.keymodel, OptionConstants.virtualedit)
class MotionArrowDownActionTest : VimTestCase() { class MotionArrowDownActionTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel) @TraceOptions(OptionConstants.keymodel)
class MotionArrowUpActionTest : VimTestCase() { class MotionArrowUpActionTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode) @TraceOptions(OptionConstants.keymodel, OptionConstants.selectmode)
class MotionShiftDownActionHandlerTest : VimTestCase() { class MotionShiftDownActionHandlerTest : VimTestCase() {

View File

@ -12,12 +12,12 @@ package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.command.VimStateMachine import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
@TraceOptions(OptionConstants.selectmode, OptionConstants.keymodel) @TraceOptions(OptionConstants.selectmode, OptionConstants.keymodel)
class MotionShiftUpActionHandlerTest : VimTestCase() { class MotionShiftUpActionHandlerTest : VimTestCase() {

View File

@ -12,7 +12,6 @@ import com.intellij.openapi.editor.Inlay
import com.maddyhome.idea.vim.helper.EditorHelper import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.Assert
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -74,7 +73,7 @@ class ScrollFirstScreenColumnActionTest : VimTestCase() {
// The first visible text column will be 99, with the inlay positioned to the left of it // The first visible text column will be 99, with the inlay positioned to the left of it
assertVisibleLineBounds(0, 99, 99 + availableColumns - 1) assertVisibleLineBounds(0, 99, 99 + availableColumns - 1)
Assert.assertEquals(visibleArea.x, inlay.bounds!!.x) assertEquals(visibleArea.x, inlay.bounds!!.x)
} }
@Test @Test

View File

@ -11,7 +11,6 @@ package org.jetbrains.plugins.ideavim.action.scroll
import com.intellij.openapi.editor.Inlay import com.intellij.openapi.editor.Inlay
import com.maddyhome.idea.vim.helper.EditorHelper import com.maddyhome.idea.vim.helper.EditorHelper
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.Assert
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -112,8 +111,8 @@ class ScrollLastScreenColumnActionTest : VimTestCase() {
// We have to assert the location of the inlay // We have to assert the location of the inlay
val inlayX = fixture.editor.visualPositionToPoint2D(inlay.visualPosition).x.roundToInt() val inlayX = fixture.editor.visualPositionToPoint2D(inlay.visualPosition).x.roundToInt()
Assert.assertEquals(visibleArea.x + textWidth, inlayX) assertEquals(visibleArea.x + textWidth, inlayX)
Assert.assertEquals(visibleArea.x + visibleArea.width, inlayX + inlay.widthInPixels) assertEquals(visibleArea.x + visibleArea.width, inlayX + inlay.widthInPixels)
} }
@Test @Test

View File

@ -11,12 +11,12 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
import com.maddyhome.idea.vim.api.injector import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
/** /**

View File

@ -14,10 +14,10 @@ import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.impl.VimOption
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.TestInfo import org.junit.jupiter.api.TestInfo

View File

@ -135,7 +135,7 @@ class SearchGroupTest : VimTestCase() {
"\\c[ABC]b", "\\c[ABC]b",
"${c}dd\n", "${c}dd\n",
) )
kotlin.test.assertEquals(-1, pos) assertEquals(-1, pos)
} }
// VIM-856 // VIM-856
@ -146,7 +146,7 @@ class SearchGroupTest : VimTestCase() {
"a\\@<!b", "a\\@<!b",
"${c}ab\n", "${c}ab\n",
) )
kotlin.test.assertEquals(-1, pos) assertEquals(-1, pos)
} }
@TestWithoutNeovim(reason = SkipNeovimReason.DIFFERENT) @TestWithoutNeovim(reason = SkipNeovimReason.DIFFERENT)
@ -1518,7 +1518,7 @@ class SearchGroupTest : VimTestCase() {
@Test @Test
fun `test find last cr in file`() { fun `test find last cr in file`() {
val res = search("\\n", "Something\n") val res = search("\\n", "Something\n")
kotlin.test.assertEquals(9, res) assertEquals(9, res)
} }
private fun search(pattern: String, input: String): Int { private fun search(pattern: String, input: String): Int {
@ -1541,7 +1541,7 @@ class SearchGroupTest : VimTestCase() {
} }
private fun assertNoSearchHighlights() { private fun assertNoSearchHighlights() {
kotlin.test.assertEquals(0, fixture.editor.markupModel.allHighlighters.size) assertEquals(0, fixture.editor.markupModel.allHighlighters.size)
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@ -1572,7 +1572,7 @@ class SearchGroupTest : VimTestCase() {
offset += v.length offset += v.length
} }
kotlin.test.assertEquals(expected, actual.toString()) assertEquals(expected, actual.toString())
// Assert all highlighters have the correct tooltip and text attributes // Assert all highlighters have the correct tooltip and text attributes
val editorColorsScheme = EditorColorsManager.getInstance().globalScheme val editorColorsScheme = EditorColorsManager.getInstance().globalScheme
@ -1580,7 +1580,7 @@ class SearchGroupTest : VimTestCase() {
val caretColour = editorColorsScheme.getColor(EditorColors.CARET_COLOR) val caretColour = editorColorsScheme.getColor(EditorColors.CARET_COLOR)
allHighlighters.forEach { allHighlighters.forEach {
val offsets = "(${it.startOffset}, ${it.endOffset})" val offsets = "(${it.startOffset}, ${it.endOffset})"
kotlin.test.assertEquals(tooltip, it.errorStripeTooltip, "Incorrect tooltip for highlighter at $offsets") assertEquals(tooltip, it.errorStripeTooltip, "Incorrect tooltip for highlighter at $offsets")
assertEquals( assertEquals(
attributes.backgroundColor, attributes.backgroundColor,
it.textAttributes?.backgroundColor, it.textAttributes?.backgroundColor,

View File

@ -12,19 +12,20 @@ package org.jetbrains.plugins.ideavim.group.motion
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
// These tests are sanity tests for scrolloff and scrolljump, with actions that move the cursor. Other actions that are // These tests are sanity tests for scrolloff and scrolljump, with actions that move the cursor. Other actions that are
// affected by scrolloff or scrolljump should include that in the action specific tests // affected by scrolloff or scrolljump should include that in the action specific tests
@TraceOptions(OptionConstants.scrolloff) @TraceOptions(OptionConstants.scrolloff)
class MotionGroup_scrolloff_Test : VimTestCase() { class MotionGroup_scrolloff_Test : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"])) fun `test move up shows no context with scrolloff=0`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"]))
fun `test move up shows no context with scrolloff=0`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 25) setPositionAndScroll(25, 25)
typeText("k") typeText("k")
@ -33,7 +34,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["1"])) fun `test move up shows context line with scrolloff=1`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["1"]))
fun `test move up shows context line with scrolloff=1`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 26) setPositionAndScroll(25, 26)
typeText("k") typeText("k")
@ -42,7 +44,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["10"])) fun `test move up shows context lines with scrolloff=10`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["10"]))
fun `test move up shows context lines with scrolloff=10`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 35) setPositionAndScroll(25, 35)
typeText("k") typeText("k")
@ -51,7 +54,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["15"])) fun `test move up when scrolloff is slightly less than half screen height`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["15"]))
fun `test move up when scrolloff is slightly less than half screen height`() {
// Screen height = 35. scrolloff=15. This gives 5 possible caret lines without scrolling (48, 49, 50, 51 + 52) // Screen height = 35. scrolloff=15. This gives 5 possible caret lines without scrolling (48, 49, 50, 51 + 52)
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 52) setPositionAndScroll(33, 52)
@ -79,7 +83,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"])) fun `test move up when scrolloff is slightly less than half screen height 2`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"]))
fun `test move up when scrolloff is slightly less than half screen height 2`() {
// Screen height = 35. scrolloff=16. This gives 3 possible caret lines without scrolling (49, 50 + 51) // Screen height = 35. scrolloff=16. This gives 3 possible caret lines without scrolling (49, 50 + 51)
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 51) setPositionAndScroll(33, 51)
@ -99,7 +104,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"])) fun `test move up when scrolloff is slightly less than half screen height 3`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"]))
fun `test move up when scrolloff is slightly less than half screen height 3`() {
// Screen height = 34. scrolloff=16 // Screen height = 34. scrolloff=16
// Even numbers. 2 possible caret lines without scrolling (49 + 50) // Even numbers. 2 possible caret lines without scrolling (49 + 50)
configureByPages(5) configureByPages(5)
@ -137,7 +143,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"])) fun `test move up when scrolloff is slightly greater than screen height keeps cursor in centre of screen`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"]))
fun `test move up when scrolloff is slightly greater than screen height keeps cursor in centre of screen`() {
// Page height = 35. scrolloff=17 // Page height = 35. scrolloff=17
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 50) setPositionAndScroll(33, 50)
@ -148,7 +155,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["22"])) fun `test move up when scrolloff is slightly greater than screen height keeps cursor in centre of screen 2`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["22"]))
fun `test move up when scrolloff is slightly greater than screen height keeps cursor in centre of screen 2`() {
// Page height = 35. scrolloff=17 // Page height = 35. scrolloff=17
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 50) setPositionAndScroll(33, 50)
@ -159,7 +167,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"])) fun `test move down shows no context with scrolloff=0`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"]))
fun `test move down shows no context with scrolloff=0`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 59) setPositionAndScroll(25, 59)
typeText("j") typeText("j")
@ -168,7 +177,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["1"])) fun `test move down shows context line with scrolloff=1`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["1"]))
fun `test move down shows context line with scrolloff=1`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 58) setPositionAndScroll(25, 58)
typeText("j") typeText("j")
@ -177,7 +187,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["10"])) fun `test move down shows context lines with scrolloff=10`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["10"]))
fun `test move down shows context lines with scrolloff=10`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 49) setPositionAndScroll(25, 49)
typeText("j") typeText("j")
@ -186,7 +197,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["15"])) fun `test move down when scrolloff is slightly less than half screen height`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["15"]))
fun `test move down when scrolloff is slightly less than half screen height`() {
// Screen height = 35. scrolloff=15. This gives 5 possible caret lines without scrolling (48, 49, 50, 51 + 52) // Screen height = 35. scrolloff=15. This gives 5 possible caret lines without scrolling (48, 49, 50, 51 + 52)
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 48) setPositionAndScroll(33, 48)
@ -214,7 +226,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"])) fun `test move down when scrolloff is slightly less than half screen height 2`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"]))
fun `test move down when scrolloff is slightly less than half screen height 2`() {
// Screen height = 35. scrolloff=16. This gives 3 possible caret lines without scrolling (49, 50 + 51) // Screen height = 35. scrolloff=16. This gives 3 possible caret lines without scrolling (49, 50 + 51)
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 49) setPositionAndScroll(33, 49)
@ -234,7 +247,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"])) fun `test move down when scrolloff is slightly less than half screen height 3`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["16"]))
fun `test move down when scrolloff is slightly less than half screen height 3`() {
// Screen height = 34. scrolloff=16 // Screen height = 34. scrolloff=16
// Even numbers. 2 possible caret lines without scrolling (49 + 50) // Even numbers. 2 possible caret lines without scrolling (49 + 50)
configureByPages(5) configureByPages(5)
@ -252,7 +266,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"])) fun `test move down when scrolloff is exactly screen height`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"]))
fun `test move down when scrolloff is exactly screen height`() {
// Page height = 34. scrolloff=17 // Page height = 34. scrolloff=17
// 2 possible caret lines without scrolling (49 + 50), but moving to line 51 will scroll 2 lines! // 2 possible caret lines without scrolling (49 + 50), but moving to line 51 will scroll 2 lines!
configureByPages(5) configureByPages(5)
@ -270,7 +285,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"])) fun `test move down when scrolloff is slightly greater than half screen height keeps cursor in centre of screen`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["17"]))
fun `test move down when scrolloff is slightly greater than half screen height keeps cursor in centre of screen`() {
// Page height = 35. scrolloff=17 // Page height = 35. scrolloff=17
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 50) setPositionAndScroll(33, 50)
@ -281,7 +297,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["22"])) fun `test move down when scrolloff is slightly greater than half screen height keeps cursor in centre of screen 2`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["22"]))
fun `test move down when scrolloff is slightly greater than half screen height keeps cursor in centre of screen 2`() {
// Page height = 35. scrolloff=17 // Page height = 35. scrolloff=17
configureByPages(5) configureByPages(5)
setPositionAndScroll(33, 50) setPositionAndScroll(33, 50)
@ -292,7 +309,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["999"])) fun `test scrolloff=999 keeps cursor in centre of screen`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["999"]))
fun `test scrolloff=999 keeps cursor in centre of screen`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 42) setPositionAndScroll(25, 42)
@ -306,7 +324,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["999"])) fun `test scrolloff=999 keeps cursor in centre of screen with even screen height`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["999"]))
fun `test scrolloff=999 keeps cursor in centre of screen with even screen height`() {
configureByPages(5) configureByPages(5)
setEditorVisibleSize(screenWidth, 34) setEditorVisibleSize(screenWidth, 34)
setPositionAndScroll(26, 42) setPositionAndScroll(26, 42)
@ -321,7 +340,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"])) fun `test reposition cursor when scrolloff is set`() { @OptionTest(VimOption(OptionConstants.scrolloff, limitedValues = ["0"]))
fun `test reposition cursor when scrolloff is set`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(50, 50) setPositionAndScroll(50, 50)
@ -334,7 +354,8 @@ class MotionGroup_scrolloff_Test : VimTestCase() {
@TraceOptions(OptionConstants.scrolljump) @TraceOptions(OptionConstants.scrolljump)
class MotionGroup_scrolljump_Test : VimTestCase() { class MotionGroup_scrolljump_Test : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["0"])) fun `test move up scrolls single line with scrolljump=0`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["0"]))
fun `test move up scrolls single line with scrolljump=0`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 25) setPositionAndScroll(25, 25)
typeText("k") typeText("k")
@ -343,7 +364,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["1"])) fun `test move up scrolls single line with scrolljump=1`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["1"]))
fun `test move up scrolls single line with scrolljump=1`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 25) setPositionAndScroll(25, 25)
typeText("k") typeText("k")
@ -352,7 +374,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["10"])) fun `test move up scrolls multiple lines with scrolljump=10`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["10"]))
fun `test move up scrolls multiple lines with scrolljump=10`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 25) setPositionAndScroll(25, 25)
typeText("k") typeText("k")
@ -361,7 +384,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["0"])) fun `test move down scrolls single line with scrolljump=0`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["0"]))
fun `test move down scrolls single line with scrolljump=0`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 59) setPositionAndScroll(25, 59)
typeText("j") typeText("j")
@ -370,7 +394,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["1"])) fun `test move down scrolls single line with scrolljump=1`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["1"]))
fun `test move down scrolls single line with scrolljump=1`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 59) setPositionAndScroll(25, 59)
typeText("j") typeText("j")
@ -379,7 +404,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["10"])) fun `test move down scrolls multiple lines with scrolljump=10`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["10"]))
fun `test move down scrolls multiple lines with scrolljump=10`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(25, 59) setPositionAndScroll(25, 59)
typeText("j") typeText("j")
@ -388,7 +414,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["-50"])) fun `test negative scrolljump treated as percentage 1`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["-50"]))
fun `test negative scrolljump treated as percentage 1`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(39, 39) setPositionAndScroll(39, 39)
typeText("k") typeText("k")
@ -397,7 +424,8 @@ class MotionGroup_scrolljump_Test : VimTestCase() {
} }
@TestWithoutNeovim(SkipNeovimReason.OPTION) @TestWithoutNeovim(SkipNeovimReason.OPTION)
@OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["-10"])) fun `test negative scrolljump treated as percentage 2`() { @OptionTest(VimOption(OptionConstants.scrolljump, limitedValues = ["-10"]))
fun `test negative scrolljump treated as percentage 2`() {
configureByPages(5) configureByPages(5)
setPositionAndScroll(39, 39) setPositionAndScroll(39, 39)
typeText("k") typeText("k")

View File

@ -21,12 +21,12 @@ import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.helper.subMode import com.maddyhome.idea.vim.helper.subMode
import com.maddyhome.idea.vim.listener.VimListenerManager import com.maddyhome.idea.vim.listener.VimListenerManager
import com.maddyhome.idea.vim.options.OptionConstants import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.waitAndAssert import org.jetbrains.plugins.ideavim.waitAndAssert
import org.jetbrains.plugins.ideavim.waitAndAssertMode import org.jetbrains.plugins.ideavim.waitAndAssertMode

View File

@ -28,13 +28,13 @@ import com.maddyhome.idea.vim.helper.inNormalMode
import com.maddyhome.idea.vim.helper.inSelectMode import com.maddyhome.idea.vim.helper.inSelectMode
import com.maddyhome.idea.vim.helper.inVisualMode import com.maddyhome.idea.vim.helper.inVisualMode
import com.maddyhome.idea.vim.listener.VimListenerManager import com.maddyhome.idea.vim.listener.VimListenerManager
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.assertDoesntChange import org.jetbrains.plugins.ideavim.assertDoesntChange
import org.jetbrains.plugins.ideavim.impl.OptionTest
import org.jetbrains.plugins.ideavim.impl.TraceOptions
import org.jetbrains.plugins.ideavim.impl.VimOption
import org.jetbrains.plugins.ideavim.waitAndAssertMode import org.jetbrains.plugins.ideavim.waitAndAssertMode
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.TestInfo import org.junit.jupiter.api.TestInfo
@ -309,7 +309,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template in normal mode`() { fun `test template in normal mode`() {
@ -327,7 +327,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test save mode for insert mode`() { fun `test save mode for insert mode`() {
@ -346,7 +346,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test save mode for visual mode`() { fun `test save mode for visual mode`() {
@ -365,7 +365,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to select in normal mode`() { fun `test template to select in normal mode`() {
@ -383,7 +383,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to select in insert mode`() { fun `test template to select in insert mode`() {
@ -402,7 +402,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to select in visual mode`() { fun `test template to select in visual mode`() {
@ -421,7 +421,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_select]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to select in select mode`() { fun `test template to select in select mode`() {
@ -440,7 +440,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to visual in normal mode`() { fun `test template to visual in normal mode`() {
@ -458,7 +458,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to visual in insert mode`() { fun `test template to visual in insert mode`() {
@ -477,7 +477,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to visual in visual mode`() { fun `test template to visual in visual mode`() {
@ -496,7 +496,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_visual]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template to visual in select mode`() { fun `test template to visual in select mode`() {
@ -515,7 +515,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template with multiple times`() { fun `test template with multiple times`() {
@ -538,7 +538,7 @@ class TemplateTest : VimTestCase() {
} }
@OptionTest( @OptionTest(
VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]) VimOption(IjOptionConstants.idearefactormode, limitedValues = [IjOptionConstants.idearefactormode_keep]),
) )
@TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES) @TestWithoutNeovim(reason = SkipNeovimReason.TEMPLATES)
fun `test template with lookup`() { fun `test template with lookup`() {

View File

@ -12,7 +12,6 @@ import com.maddyhome.idea.vim.helper.EditorHelper
import org.jetbrains.plugins.ideavim.SkipNeovimReason import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.Assert
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -24,7 +23,7 @@ class EditorHelperTest : VimTestCase() {
EditorHelper.scrollColumnToLeftOfScreen(fixture.editor, 0, 2) EditorHelper.scrollColumnToLeftOfScreen(fixture.editor, 0, 2)
val visibleArea = fixture.editor.scrollingModel.visibleArea val visibleArea = fixture.editor.scrollingModel.visibleArea
val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor) val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor)
Assert.assertEquals((2 * columnWidth).roundToInt(), visibleArea.x) assertEquals((2 * columnWidth).roundToInt(), visibleArea.x)
} }
@TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING) @TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING)
@ -35,7 +34,7 @@ class EditorHelperTest : VimTestCase() {
EditorHelper.scrollColumnToRightOfScreen(fixture.editor, 0, column) EditorHelper.scrollColumnToRightOfScreen(fixture.editor, 0, column)
val visibleArea = fixture.editor.scrollingModel.visibleArea val visibleArea = fixture.editor.scrollingModel.visibleArea
val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor) val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor)
Assert.assertEquals(((column - screenWidth + 1) * columnWidth).roundToInt(), visibleArea.x) assertEquals(((column - screenWidth + 1) * columnWidth).roundToInt(), visibleArea.x)
} }
@TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING) @TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING)
@ -48,7 +47,7 @@ class EditorHelperTest : VimTestCase() {
EditorHelper.scrollColumnToMiddleOfScreen(fixture.editor, 0, 99) EditorHelper.scrollColumnToMiddleOfScreen(fixture.editor, 0, 99)
val visibleArea = fixture.editor.scrollingModel.visibleArea val visibleArea = fixture.editor.scrollingModel.visibleArea
val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor) val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor)
Assert.assertEquals((59 * columnWidth).roundToInt(), visibleArea.x) assertEquals((59 * columnWidth).roundToInt(), visibleArea.x)
} }
@TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING) @TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING)
@ -62,6 +61,6 @@ class EditorHelperTest : VimTestCase() {
EditorHelper.scrollColumnToMiddleOfScreen(fixture.editor, 0, 99) EditorHelper.scrollColumnToMiddleOfScreen(fixture.editor, 0, 99)
val visibleArea = fixture.editor.scrollingModel.visibleArea val visibleArea = fixture.editor.scrollingModel.visibleArea
val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor) val columnWidth = EditorHelper.getPlainSpaceWidthFloat(fixture.editor)
Assert.assertEquals((59 * columnWidth).roundToInt(), visibleArea.x) assertEquals((59 * columnWidth).roundToInt(), visibleArea.x)
} }
} }

View File

@ -107,7 +107,6 @@ internal annotation class VimOption(
val doesntAffectTest: Boolean = false, val doesntAffectTest: Boolean = false,
) )
// ----------- Implementation // ----------- Implementation
private class OptionsVerificator : BeforeTestExecutionCallback, AfterTestExecutionCallback { private class OptionsVerificator : BeforeTestExecutionCallback, AfterTestExecutionCallback {
@ -315,7 +314,9 @@ private class VimOptionsInvocator : TestTemplateInvocationContextProvider {
.map { VimString(it.joinToString(",")) } .map { VimString(it.joinToString(",")) }
}.flatten() }.flatten()
valuesCombinations.map { option to it } valuesCombinations.map { option to it }
} else fail("Cannot generate values automatically. Please specify option values explicitelly using 'limitedValues' field") } else {
fail("Cannot generate values automatically. Please specify option values explicitelly using 'limitedValues' field")
}
} else { } else {
val boundedValues = option.boundedValues val boundedValues = option.boundedValues
if (boundedValues != null) { if (boundedValues != null) {