-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some tests for the getcmdtype() function
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
.../java/org/jetbrains/plugins/ideavim/ex/implementation/functions/GetCmdTypeFunctionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2003-2024 The IdeaVim authors | ||
* | ||
* Use of this source code is governed by an MIT-style | ||
* license that can be found in the LICENSE.txt file or at | ||
* https://opensource.org/licenses/MIT. | ||
*/ | ||
|
||
package org.jetbrains.plugins.ideavim.ex.implementation.functions | ||
|
||
import com.maddyhome.idea.vim.api.injector | ||
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel | ||
import org.jetbrains.plugins.ideavim.VimTestCase | ||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
|
||
class GetCmdTypeFunctionTest : VimTestCase() { | ||
|
||
@Test | ||
fun `test getcmdtype() for a regular command`() { | ||
configureByText("\n") | ||
enterCommand("cmap <expr> z getcmdtype()") | ||
typeText(":fooz") | ||
assertEquals("foo:", (injector.commandLine.getActiveCommandLine() as ExEntryPanel).visibleText) | ||
} | ||
|
||
@Test | ||
fun `test getcmdtype() for a forward search`() { | ||
configureByText("\n") | ||
enterCommand("cmap <expr> z getcmdtype()") | ||
typeText("/fooz") | ||
assertEquals("foo/", (injector.commandLine.getActiveCommandLine() as ExEntryPanel).visibleText) | ||
} | ||
|
||
@Test | ||
fun `test getcmdtype() for a backward search`() { | ||
configureByText("\n") | ||
enterCommand("cmap <expr> z getcmdtype()") | ||
typeText("?fooz") | ||
assertEquals("foo?", (injector.commandLine.getActiveCommandLine() as ExEntryPanel).visibleText) | ||
} | ||
|
||
@Test | ||
fun `test getcmdtype() for an expression command`() { | ||
configureByText("\n") | ||
enterCommand("cmap <expr> z getcmdtype()") | ||
typeText("i<C-r>=fooz") | ||
assertEquals("foo=", (injector.commandLine.getActiveCommandLine() as ExEntryPanel).visibleText) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters