Skip to content

Commit

Permalink
minimal tests for go to prev/next actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Oct 18, 2019
1 parent 087137a commit 969eb2c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import com.intellij.psi.PsiFile
import com.intellij.testFramework.EditorTestUtil
import org.junit.Assert.assertNotNull

abstract class HoconEditorActionTest protected(
override protected val actionId: String,
subPath: String
) extends HoconActionTest(actionId, subPath) {
abstract class HoconEditorActionTest(actionId: String, subPath: String)
extends HoconActionTest(actionId, subPath) {

override protected def executeAction(dataContext: DataContext, editor: Editor): Unit = {
val actionHandler = EditorActionManager.getInstance.getActionHandler(actionId)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.jetbrains.plugins.hocon
package navigation

import com.intellij.openapi.editor.Editor
import com.intellij.psi.PsiFile

abstract class HoconNavigationTest(actionId: String, subPath: String)
extends HoconActionTest(actionId, subPath) {
protected def extractResult(file: PsiFile, editor: Editor): String = {
val lp = editor.getCaretModel.getLogicalPosition
s"${lp.line + 1}:${lp.column + 1}"
}
}

import com.intellij.openapi.actionSystem.IdeActions

class HoconSubstitutionResolutionTest extends HoconNavigationTest(IdeActions.ACTION_GOTO_DECLARATION, "substitution")
object HoconSubstitutionResolutionTest extends TestSuiteCompanion[HoconSubstitutionResolutionTest]

class HoconGoToNextTest extends HoconNavigationTest("HoconGotoNext", "gotoNext")
object HoconGoToNextTest extends TestSuiteCompanion[HoconGoToNextTest]

class HoconGoToPrevTest extends HoconNavigationTest("HoconGotoPrev", "gotoPrev")
object HoconGoToPrevTest extends TestSuiteCompanion[HoconGoToPrevTest]

This file was deleted.

4 changes: 4 additions & 0 deletions testdata/actions/gotoNext/simple.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a<caret> = 5
a = 10
-----
2:1
4 changes: 4 additions & 0 deletions testdata/actions/gotoPrev/simple.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a = 5
a<caret> = 10
-----
1:1

0 comments on commit 969eb2c

Please sign in to comment.