mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-06-17 06:40:00 +02:00
Remove some warnings from tests
This commit is contained in:
parent
d964a0c375
commit
92f0d28d24
test
org/jetbrains/plugins/ideavim
action
copy
scroll
extension/highlightedyank
ui/utils
@ -23,7 +23,6 @@ import com.maddyhome.idea.vim.command.CommandState
|
|||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.option.ClipboardOptionsData
|
import com.maddyhome.idea.vim.option.ClipboardOptionsData
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
import junit.framework.Assert
|
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
@ -60,6 +59,7 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
TestCase.assertEquals(initialOffset, myFixture.editor.caretModel.offset)
|
TestCase.assertEquals(initialOffset, myFixture.editor.caretModel.offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DANGEROUS_CHARACTERS")
|
||||||
fun `test unnamed saved to " register`() {
|
fun `test unnamed saved to " register`() {
|
||||||
val clipboardValue = OptionsManager.clipboard.value
|
val clipboardValue = OptionsManager.clipboard.value
|
||||||
OptionsManager.clipboard.set(ClipboardOptionsData.unnamed)
|
OptionsManager.clipboard.set(ClipboardOptionsData.unnamed)
|
||||||
@ -69,32 +69,34 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
typeText(parseKeys("yiw"))
|
typeText(parseKeys("yiw"))
|
||||||
|
|
||||||
val starRegister = VimPlugin.getRegister().getRegister('*') ?: kotlin.test.fail("Register * is empty")
|
val starRegister = VimPlugin.getRegister().getRegister('*') ?: kotlin.test.fail("Register * is empty")
|
||||||
Assert.assertEquals("legendary", starRegister.text)
|
assertEquals("legendary", starRegister.text)
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
Assert.assertEquals("legendary", quoteRegister.text)
|
assertEquals("legendary", quoteRegister.text)
|
||||||
} finally {
|
} finally {
|
||||||
OptionsManager.clipboard.set(clipboardValue)
|
OptionsManager.clipboard.set(clipboardValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DANGEROUS_CHARACTERS")
|
||||||
fun `test z saved to " register`() {
|
fun `test z saved to " register`() {
|
||||||
configureByText("I found it in a ${c}legendary land")
|
configureByText("I found it in a ${c}legendary land")
|
||||||
typeText(parseKeys("\"zyiw"))
|
typeText(parseKeys("\"zyiw"))
|
||||||
|
|
||||||
val starRegister = VimPlugin.getRegister().getRegister('z') ?: kotlin.test.fail("Register z is empty")
|
val starRegister = VimPlugin.getRegister().getRegister('z') ?: kotlin.test.fail("Register z is empty")
|
||||||
Assert.assertEquals("legendary", starRegister.text)
|
assertEquals("legendary", starRegister.text)
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
Assert.assertEquals("legendary", quoteRegister.text)
|
assertEquals("legendary", quoteRegister.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DANGEROUS_CHARACTERS")
|
||||||
fun `test " saved to " register`() {
|
fun `test " saved to " register`() {
|
||||||
configureByText("I found it in a ${c}legendary land")
|
configureByText("I found it in a ${c}legendary land")
|
||||||
typeText(parseKeys("\"zyiw"))
|
typeText(parseKeys("\"zyiw"))
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
Assert.assertEquals("legendary", quoteRegister.text)
|
assertEquals("legendary", quoteRegister.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test yank up`() {
|
fun `test yank up`() {
|
||||||
@ -108,7 +110,7 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile(parseKeys("yk"), file)
|
typeTextInFile(parseKeys("yk"), file)
|
||||||
|
|
||||||
Assert.assertTrue(VimPlugin.isError())
|
assertTrue(VimPlugin.isError())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test yank dollar at last empty line`() {
|
fun `test yank dollar at last empty line`() {
|
||||||
@ -154,7 +156,7 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile(commandToKeys("map * *yiw"), file)
|
typeTextInFile(commandToKeys("map * *yiw"), file)
|
||||||
typeTextInFile(parseKeys("\"*"), file)
|
typeTextInFile(parseKeys("\"*"), file)
|
||||||
Assert.assertNull(VimPlugin.getRegister().lastRegister?.text)
|
assertNull(VimPlugin.getRegister().lastRegister?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test yank last line`() {
|
fun `test yank last line`() {
|
||||||
|
@ -22,7 +22,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
import junit.framework.Assert
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -83,7 +82,7 @@ class ScrollHalfPageDownActionTest : VimTestCase() {
|
|||||||
configureByPages(5)
|
configureByPages(5)
|
||||||
setPositionAndScroll(100, 110)
|
setPositionAndScroll(100, 110)
|
||||||
typeText(parseKeys("10<C-D>"))
|
typeText(parseKeys("10<C-D>"))
|
||||||
Assert.assertEquals(OptionsManager.scroll.value(), 10)
|
assertEquals(OptionsManager.scroll.value(), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test scroll downwards uses scroll option`() {
|
fun `test scroll downwards uses scroll option`() {
|
||||||
|
@ -22,7 +22,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
import junit.framework.Assert
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -75,7 +74,7 @@ class ScrollHalfPageUpActionTest : VimTestCase() {
|
|||||||
configureByPages(5)
|
configureByPages(5)
|
||||||
setPositionAndScroll(50, 53)
|
setPositionAndScroll(50, 53)
|
||||||
typeText(parseKeys("10<C-U>"))
|
typeText(parseKeys("10<C-U>"))
|
||||||
Assert.assertEquals(OptionsManager.scroll.value(), 10)
|
assertEquals(OptionsManager.scroll.value(), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test scroll upwards uses scroll option`() {
|
fun `test scroll upwards uses scroll option`() {
|
||||||
|
@ -21,7 +21,6 @@ package org.jetbrains.plugins.ideavim.action.scroll
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
import junit.framework.Assert
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -155,7 +154,7 @@ class ScrollPageUpActionTest : VimTestCase() {
|
|||||||
configureByPages(5)
|
configureByPages(5)
|
||||||
setPositionAndScroll(0, 25)
|
setPositionAndScroll(0, 25)
|
||||||
typeText(parseKeys("<C-B>"))
|
typeText(parseKeys("<C-B>"))
|
||||||
Assert.assertTrue(VimPlugin.isError())
|
assertTrue(VimPlugin.isError())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test scroll page up on second page moves cursor to previous top`() {
|
fun `test scroll page up on second page moves cursor to previous top`() {
|
||||||
|
@ -23,7 +23,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.command.CommandState
|
import com.maddyhome.idea.vim.command.CommandState
|
||||||
import com.maddyhome.idea.vim.extension.highlightedyank.DEFAULT_HIGHLIGHT_DURATION
|
import com.maddyhome.idea.vim.extension.highlightedyank.DEFAULT_HIGHLIGHT_DURATION
|
||||||
import com.maddyhome.idea.vim.helper.StringHelper
|
import com.maddyhome.idea.vim.helper.StringHelper
|
||||||
import junit.framework.Assert
|
|
||||||
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
|
||||||
@ -71,7 +70,7 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_duration = \"500.15\"<CR>"))
|
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_duration = \"500.15\"<CR>"))
|
||||||
typeText(StringHelper.parseKeys("yy"))
|
typeText(StringHelper.parseKeys("yy"))
|
||||||
|
|
||||||
Assert.assertEquals(
|
assertEquals(
|
||||||
VimPlugin.getMessage(),
|
VimPlugin.getMessage(),
|
||||||
"highlightedyank: Invalid value of g:highlightedyank_highlight_duration -- For input string: \"500.15\""
|
"highlightedyank: Invalid value of g:highlightedyank_highlight_duration -- For input string: \"500.15\""
|
||||||
)
|
)
|
||||||
@ -83,7 +82,7 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_duration = \"-1\"<CR>"))
|
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_duration = \"-1\"<CR>"))
|
||||||
typeText(StringHelper.parseKeys("yy"))
|
typeText(StringHelper.parseKeys("yy"))
|
||||||
|
|
||||||
Assert.assertEquals(VimPlugin.getMessage(), "")
|
assertEquals(VimPlugin.getMessage(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test indicating error when incorrect highlight color was provided by user`() {
|
fun `test indicating error when incorrect highlight color was provided by user`() {
|
||||||
@ -93,7 +92,7 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_color = \"$color\"<CR>"))
|
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_color = \"$color\"<CR>"))
|
||||||
typeText(StringHelper.parseKeys("yy"))
|
typeText(StringHelper.parseKeys("yy"))
|
||||||
|
|
||||||
Assert.assertTrue(
|
assertTrue(
|
||||||
color,
|
color,
|
||||||
VimPlugin.getMessage().contains("highlightedyank: Invalid value of g:highlightedyank_highlight_color")
|
VimPlugin.getMessage().contains("highlightedyank: Invalid value of g:highlightedyank_highlight_color")
|
||||||
)
|
)
|
||||||
@ -107,7 +106,7 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_color = \"$color\"<CR>"))
|
typeText(StringHelper.parseKeys(":let g:highlightedyank_highlight_color = \"$color\"<CR>"))
|
||||||
typeText(StringHelper.parseKeys("yy"))
|
typeText(StringHelper.parseKeys("yy"))
|
||||||
|
|
||||||
Assert.assertEquals("", VimPlugin.getMessage())
|
assertEquals("", VimPlugin.getMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +165,7 @@ fun sum(x: ${c}Int, y: ${c}Int, z: ${c}Int): Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun assertAllHighlightersCount(count: Int) {
|
private fun assertAllHighlightersCount(count: Int) {
|
||||||
Assert.assertEquals(count, getAllHighlightersCount())
|
assertEquals(count, getAllHighlightersCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAllHighlightersCount() = myFixture.editor.markupModel.allHighlighters.size
|
private fun getAllHighlightersCount() = myFixture.editor.markupModel.allHighlighters.size
|
||||||
|
@ -61,7 +61,7 @@ fun RemoteText.moveMouseInGutterTo(goal: RemoteText, fixture: Fixture) {
|
|||||||
this.moveMouse()
|
this.moveMouse()
|
||||||
val goalPoint = goal.point
|
val goalPoint = goal.point
|
||||||
|
|
||||||
val caretDuringDragging = fixture.runJs(
|
fixture.runJs(
|
||||||
"""
|
"""
|
||||||
const point = new java.awt.Point(${goalPoint.x}, ${goalPoint.y});
|
const point = new java.awt.Point(${goalPoint.x}, ${goalPoint.y});
|
||||||
robot.pressMouseWhileRunning(MouseButton.LEFT_BUTTON, () => {
|
robot.pressMouseWhileRunning(MouseButton.LEFT_BUTTON, () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user