1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-03-10 12:32:19 +01:00

Add more tests for till character motions

This commit is contained in:
Alex Plate 2021-06-28 07:46:25 +03:00
parent 16d9a3ba8b
commit 1f9718a3c1
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
4 changed files with 176 additions and 6 deletions

View File

@ -134,12 +134,6 @@ public class MultipleCaretsTest extends VimTestCase {
assertState("aaaba<caret>baba<caret>b<caret>b<caret>x");
}
@TestWithoutNeovim(reason = SkipNeovimReason.MULTICARET)
public void testMotionLastLeftTillMatchChar() {
typeTextInFile(parseKeys("Ta,"), "b<caret>aba<caret>a<caret>a<caret>ba<caret>b");
assertState("ba<caret>baa<caret>a<caret>ba<caret>b");
}
@TestWithoutNeovim(reason = SkipNeovimReason.MULTICARET)
public void testMotionLastRightTillMatchChar() {
typeTextInFile(parseKeys("ta;"), "<caret>b<caret>a<caret>b<caret>a<caret>a<caret>a<caret>ba<caret>b");

View File

@ -0,0 +1,56 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2021 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.CommandState
import org.jetbrains.plugins.ideavim.VimTestCase
class MotionLeftMatchCharActionTest : VimTestCase() {
fun `test move and repeat`() {
doTest("Fx;",
"hello x hello x hello${c}",
"hello ${c}x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat twice`() {
doTest("Fx;;",
"hello x hello x hello x hello${c}",
"hello ${c}x hello x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat two`() {
doTest("Fx2;",
"hello x hello x hello x hello${c}",
"hello ${c}x hello x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat three`() {
doTest("Fx3;",
"hello x hello x hello x hello x hello${c}",
"hello ${c}x hello x hello x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
}

View File

@ -0,0 +1,56 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2021 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.CommandState
import org.jetbrains.plugins.ideavim.VimTestCase
class MotionRightMatchCharActionTest : VimTestCase() {
fun `test move and repeat`() {
doTest("fx;",
"hello ${c}x hello x hello",
"hello x hello ${c}x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat twice`() {
doTest("fx;;",
"${c}hello x hello x hello x hello",
"hello x hello x hello ${c}x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat two`() {
doTest("fx2;",
"${c}hello x hello x hello x hello",
"hello x hello x hello ${c}x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat three`() {
doTest("fx3;",
"${c}hello x hello x hello x hello x hello",
"hello x hello x hello x hello ${c}x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
}

View File

@ -0,0 +1,64 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2021 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.command.CommandState
import org.jetbrains.plugins.ideavim.VimTestCase
class MotionRightTillMatchCharActionTest : VimTestCase() {
fun `test move and repeat`() {
doTest("tx;",
"${c}hello x hello x hello",
"hello x hello${c} x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat twice`() {
doTest("tx;;",
"${c}hello x hello x hello x hello",
"hello x hello x hello${c} x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat two`() {
doTest("tx2;",
"${c}hello x hello x hello x hello",
"hello x hello${c} x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat three`() {
doTest("tx3;",
"${c}hello x hello x hello x hello x hello",
"hello x hello x hello${c} x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test move and repeat backwards`() {
doTest("tx,",
"hello x hello x ${c}hello x hello x hello",
"hello x hello x${c} hello x hello x hello",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
}