Skip to content

Commit

Permalink
Fix nullable editor in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lippfi authored and AlexPl292 committed Nov 22, 2024
1 parent 94d7902 commit 0dd63c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class PutTestAfterCursorActionTest : VimTestCase() {
${c}where it was settled on some sodden sand
${c}hard by the torrent of a mountain pass.
""".trimIndent()
val vimEditor = fixture.editor.vim
val editor = configureByText(before)
val vimEditor = editor.vim
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
val registerService = injector.registerGroup
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class PutTextBeforeCursorActionTest : VimTestCase() {
where it was settled on some sodden sand
hard by the torrent of a mountain pass.
""".trimIndent()
val vimEditor = fixture.editor.vim
val editor = configureByText(before)
val vimEditor = editor.vim
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
val registerService = injector.registerGroup
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ class ReplaceWithRegisterTest : VimTestCase() {
@Test
fun `test replace use different register`() {
val text = "one ${c}two three four"
val vimEditor = fixture.editor.vim
val editor = configureByText(text)
val vimEditor = editor.vim
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
val registerService = injector.registerGroup

configureByText(text)
typeText(injector.parser.parseKeys("\"ayiw" + "w" + "\"agriw"))
assertState("one two tw${c}o four")
assertEquals("two", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
Expand All @@ -97,11 +96,10 @@ class ReplaceWithRegisterTest : VimTestCase() {
@Test
fun `test replace use clipboard register`() {
val text = "one ${c}two three four"
val vimEditor = fixture.editor.vim
val editor = configureByText(text)
val vimEditor = editor.vim
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
val registerService = injector.registerGroup

configureByText(text)
typeText(injector.parser.parseKeys("\"+yiw" + "w" + "\"+griw" + "w" + "\"+griw"))
assertState("one two two tw${c}o")
assertEquals("two", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
Expand Down

0 comments on commit 0dd63c7

Please sign in to comment.