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

Remove some warnings from tests

This commit is contained in:
Alex Plate 2021-02-24 10:30:44 +03:00
parent d964a0c375
commit 92f0d28d24
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
6 changed files with 19 additions and 21 deletions

View File

@ -23,7 +23,6 @@ import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.option.ClipboardOptionsData
import com.maddyhome.idea.vim.option.OptionsManager
import junit.framework.Assert
import junit.framework.TestCase
import org.jetbrains.plugins.ideavim.VimTestCase
@ -60,6 +59,7 @@ class YankMotionActionTest : VimTestCase() {
TestCase.assertEquals(initialOffset, myFixture.editor.caretModel.offset)
}
@Suppress("DANGEROUS_CHARACTERS")
fun `test unnamed saved to " register`() {
val clipboardValue = OptionsManager.clipboard.value
OptionsManager.clipboard.set(ClipboardOptionsData.unnamed)
@ -69,32 +69,34 @@ class YankMotionActionTest : VimTestCase() {
typeText(parseKeys("yiw"))
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")
Assert.assertEquals("legendary", quoteRegister.text)
assertEquals("legendary", quoteRegister.text)
} finally {
OptionsManager.clipboard.set(clipboardValue)
}
}
@Suppress("DANGEROUS_CHARACTERS")
fun `test z saved to " register`() {
configureByText("I found it in a ${c}legendary land")
typeText(parseKeys("\"zyiw"))
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")
Assert.assertEquals("legendary", quoteRegister.text)
assertEquals("legendary", quoteRegister.text)
}
@Suppress("DANGEROUS_CHARACTERS")
fun `test " saved to " register`() {
configureByText("I found it in a ${c}legendary land")
typeText(parseKeys("\"zyiw"))
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
Assert.assertEquals("legendary", quoteRegister.text)
assertEquals("legendary", quoteRegister.text)
}
fun `test yank up`() {
@ -108,7 +110,7 @@ class YankMotionActionTest : VimTestCase() {
""".trimIndent()
typeTextInFile(parseKeys("yk"), file)
Assert.assertTrue(VimPlugin.isError())
assertTrue(VimPlugin.isError())
}
fun `test yank dollar at last empty line`() {
@ -154,7 +156,7 @@ class YankMotionActionTest : VimTestCase() {
""".trimIndent()
typeTextInFile(commandToKeys("map * *yiw"), file)
typeTextInFile(parseKeys("\"*"), file)
Assert.assertNull(VimPlugin.getRegister().lastRegister?.text)
assertNull(VimPlugin.getRegister().lastRegister?.text)
}
fun `test yank last line`() {

View File

@ -22,7 +22,6 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.option.OptionsManager
import junit.framework.Assert
import org.jetbrains.plugins.ideavim.VimTestCase
/*
@ -83,7 +82,7 @@ class ScrollHalfPageDownActionTest : VimTestCase() {
configureByPages(5)
setPositionAndScroll(100, 110)
typeText(parseKeys("10<C-D>"))
Assert.assertEquals(OptionsManager.scroll.value(), 10)
assertEquals(OptionsManager.scroll.value(), 10)
}
fun `test scroll downwards uses scroll option`() {

View File

@ -22,7 +22,6 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.option.OptionsManager
import junit.framework.Assert
import org.jetbrains.plugins.ideavim.VimTestCase
/*
@ -75,7 +74,7 @@ class ScrollHalfPageUpActionTest : VimTestCase() {
configureByPages(5)
setPositionAndScroll(50, 53)
typeText(parseKeys("10<C-U>"))
Assert.assertEquals(OptionsManager.scroll.value(), 10)
assertEquals(OptionsManager.scroll.value(), 10)
}
fun `test scroll upwards uses scroll option`() {

View File

@ -21,7 +21,6 @@ package org.jetbrains.plugins.ideavim.action.scroll
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.option.OptionsManager
import junit.framework.Assert
import org.jetbrains.plugins.ideavim.VimTestCase
/*
@ -155,7 +154,7 @@ class ScrollPageUpActionTest : VimTestCase() {
configureByPages(5)
setPositionAndScroll(0, 25)
typeText(parseKeys("<C-B>"))
Assert.assertTrue(VimPlugin.isError())
assertTrue(VimPlugin.isError())
}
fun `test scroll page up on second page moves cursor to previous top`() {

View File

@ -23,7 +23,6 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.extension.highlightedyank.DEFAULT_HIGHLIGHT_DURATION
import com.maddyhome.idea.vim.helper.StringHelper
import junit.framework.Assert
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
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("yy"))
Assert.assertEquals(
assertEquals(
VimPlugin.getMessage(),
"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("yy"))
Assert.assertEquals(VimPlugin.getMessage(), "")
assertEquals(VimPlugin.getMessage(), "")
}
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("yy"))
Assert.assertTrue(
assertTrue(
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("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) {
Assert.assertEquals(count, getAllHighlightersCount())
assertEquals(count, getAllHighlightersCount())
}
private fun getAllHighlightersCount() = myFixture.editor.markupModel.allHighlighters.size

View File

@ -61,7 +61,7 @@ fun RemoteText.moveMouseInGutterTo(goal: RemoteText, fixture: Fixture) {
this.moveMouse()
val goalPoint = goal.point
val caretDuringDragging = fixture.runJs(
fixture.runJs(
"""
const point = new java.awt.Point(${goalPoint.x}, ${goalPoint.y});
robot.pressMouseWhileRunning(MouseButton.LEFT_BUTTON, () => {