-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch idea243.release into idea243.x
- Loading branch information
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
scala/scala-impl/test/org/jetbrains/plugins/scala/lang/navigation/GoToGivenTest.scala
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,74 @@ | ||
package org.jetbrains.plugins.scala.lang.navigation | ||
|
||
import org.jetbrains.plugins.scala.ScalaVersion | ||
import org.jetbrains.plugins.scala.lang.psi.api.base.types.ScSimpleTypeElement | ||
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.templates.ScExtendsBlock | ||
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScGivenAliasDefinition, ScGivenDefinition} | ||
|
||
class GoToGivenTest extends GoToDeclarationTestBase { | ||
override protected def supportedIn(version: ScalaVersion): Boolean = version.isScala3 | ||
|
||
// ========================== Aliases ============================== | ||
|
||
def testGotoNamedGivenAlias(): Unit = doTest( | ||
s"""object Test { | ||
| given int: Int = 0 | ||
| ${CARET}int | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScGivenAliasDefinition], "int") | ||
) | ||
|
||
def testGotoNamedAnonymousGivenAlias(): Unit = doTest( | ||
s"""object Test { | ||
| given Int = 0 | ||
| ${CARET}given_Int | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScSimpleTypeElement], "SimpleType: Int") | ||
) | ||
|
||
def testGotoNamedGivenAliasWithParams(): Unit = doTest( | ||
s"""object Test { | ||
| given int(using Int): Int = 0 | ||
| ${CARET}int | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScGivenAliasDefinition], "int") | ||
) | ||
|
||
// ========================== Definitions ============================== | ||
|
||
def testGotoNamedGivenDefinition(): Unit = doTest( | ||
s"""trait A | ||
|object Test { | ||
| given a: A with | ||
| def foo: Int = 0 | ||
| ${CARET}a | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScGivenDefinition], "Test.a") | ||
) | ||
|
||
def testGotoNamedAnonymousGivenDefinition(): Unit = doTest( | ||
s"""trait A | ||
|object Test { | ||
| given A with | ||
| def foo: Int = 0 | ||
| ${CARET}given_A | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScExtendsBlock], "ExtendsBlock") | ||
) | ||
|
||
def testGotoNamedGivenDefinitionWithParams(): Unit = doTest( | ||
s"""trait A | ||
|object Test { | ||
| given a(using Int): A with | ||
| def foo: Int = 0 | ||
| ${CARET}a | ||
|} | ||
""".stripMargin, | ||
expected = (is[ScGivenDefinition], "Test.a") | ||
) | ||
} |