Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Aug 21, 2021
1 parent de06b60 commit 3f72351
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 27 deletions.
6 changes: 6 additions & 0 deletions tests/cross/src/test/scala/tests/hover/RangeHoverSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class RangeHoverSuite extends BaseHoverSuite {
"""|immutable.IndexedSeq[Int]
|def flatMap[B, That](f: Int => GenTraversableOnce[B])(implicit bf: CanBuildFrom[immutable.IndexedSeq[Int],B,That]): That""".stripMargin.hover,
compat = Map(
"2.13" ->
"""|IndexedSeq[Int]
|override def flatMap[B](f: Int => IterableOnce[B]): IndexedSeq[B]""".stripMargin.hover,
"3.0" -> "x: Int".hover
)
)
Expand All @@ -122,6 +125,9 @@ class RangeHoverSuite extends BaseHoverSuite {
"""|List[Int]
|override def apply[A](xs: A*): List[A]""".stripMargin.hover,
compat = Map(
"2.13" ->
"""|List[Int]
|def apply[A](elems: A*): List[A]""".stripMargin.hover,
"3.0" -> "def apply[A](elems: A*): Int".hover
)
)
Expand Down
7 changes: 6 additions & 1 deletion tests/slow/src/test/scala/tests/sbt/SbtBloopLspSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ class SbtBloopLspSuite
)
hoverRes <- assertHoverAtPos("project/Deps.scala", 3, 9)
expectedHoverRes =
"""|```scala
"""|**Expression type**:
|```scala
|ModuleId
|```
|**Symbol signature**:
|```scala
|val scalatest: ModuleID
|```
|```range
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/src/test/scala/tests/BuildTargetsLspSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class BuildTargetsLspSuite
// Assert that a supported Scala version target is picked over 2.10.
_ <- server.assertHover(
"shared/Main.scala",
"""
|object Main {
| sourcecode.Line(1).val@@ue
|}""".stripMargin,
"""val value: Int""".hover
"""|object Main {
| sourcecode.Line(1).val@@ue
|}""".stripMargin,
"""|Int
|val value: Int""".stripMargin.hover
)
} yield ()
}
Expand Down
39 changes: 27 additions & 12 deletions tests/unit/src/test/scala/tests/HoverLspSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| Option(1).he@@ad
|}""".stripMargin,
"""override def head: Int""".hover
"""|Int
|override def head: Int""".stripMargin.hover
)
} yield ()
}
Expand All @@ -38,7 +39,8 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| Option(1).he@@ad
|}""".stripMargin,
"""override def head: Int""".hover
"""|Int
|override def head: Int""".stripMargin.hover
)
} yield ()
}
Expand Down Expand Up @@ -66,11 +68,15 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| val res = Def.fo@@o(1)
|}""".stripMargin,
"""|```scala
"""|**Expression type**:
|```scala
|Int
|```
|**Symbol signature**:
|```scala
|def foo(x: Int): Int
|```
|test
|""".stripMargin.hover
|test""".stripMargin
)
} yield ()
}
Expand Down Expand Up @@ -98,11 +104,15 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| val res = Def.fo@@o(1)
|}""".stripMargin,
"""|```scala
"""|**Expression type**:
|```scala
|Int
|```
|**Symbol signature**:
|```scala
|def foo(x: Int): Int
|```
|test
|""".stripMargin.hover
|test""".stripMargin
)
_ <- server.didSave("a/src/main/scala/a/Def.scala")(s =>
s.replace("test", "test2")
Expand All @@ -114,11 +124,15 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| val res = Def.fo@@o(1)
|}""".stripMargin,
"""|```scala
"""|**Expression type**:
|```scala
|Int
|```
|**Symbol signature**:
|```scala
|def foo(x: Int): Int
|```
|test2
|""".stripMargin.hover
|test2""".stripMargin
)
} yield ()
}
Expand All @@ -144,7 +158,8 @@ class HoverLspSuite extends BaseLspSuite("hover") with TestHovers {
|object Main {
| Option(1).he@@ad
|}""".stripMargin,
"""override def head: Int""".hover,
"""|Int
|override def head: Int""".stripMargin.hover,
root = workspace.resolve(Directories.readonly)
)
} yield ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ class SyntheticDecorationsLspSuite extends BaseLspSuite("implicits") {
_ <- server.assertHoverAtLine(
"a/src/main/scala/Main.scala",
" @@\"foo\".map(c => c.toUpper)",
"""|**Synthetics**:
"""|```scala
|String
|```
|
|**Synthetics**:
|```scala
|scala.Predef.augmentString
|```
Expand Down Expand Up @@ -278,7 +282,11 @@ class SyntheticDecorationsLspSuite extends BaseLspSuite("implicits") {
_ <- server.assertHoverAtLine(
"a/src/main/scala/Main.scala",
" (@@\"1\" + \"2\")",
"""|**Synthetics**:
"""|```scala
|String
|```
|
|**Synthetics**:
|```scala
|scala.Predef.augmentString
|```
Expand Down Expand Up @@ -321,7 +329,11 @@ class SyntheticDecorationsLspSuite extends BaseLspSuite("implicits") {
_ <- server.assertHoverAtLine(
"standalone/Main.scala",
" val value = @@\"asd.\".stripSuffix(\".\")",
"""|**Synthetics**:
"""|```scala
|String
|```
|
|**Synthetics**:
|```scala
|scala.Predef.augmentString
|```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ class WorksheetNoDecorationsLspSuite
|val foo = "bar" /*> : @@String = "bar" */
|println("metals") /*> @@metals */
|""".stripMargin,
"""x: Int = 1""".hover,
"""foo: String = "bar"""".hover,
"""// metals""".hover
"""|```scala
|x: Int = 1
|```""".stripMargin,
"""|```scala
|foo: String = "bar"
|```""".stripMargin,
"""|```scala
|// metals
|```""".stripMargin
)
} yield ()
}
Expand Down Expand Up @@ -81,9 +87,15 @@ class WorksheetNoDecorationsLspSuite
|val foo = "baz" /*> : String = "baz"@@ */
|println("meta ls") /*> meta@@ ls */
|""".stripMargin,
"""x: Int = 2""".hover,
"""foo: String = "baz"""".hover,
"""// meta ls""".hover
"""|```scala
|x: Int = 2
|```""".stripMargin,
"""|```scala
|foo: String = "baz"
|```""".stripMargin,
"""|```scala
|// meta ls
|```""".stripMargin
)
} yield ()
}
Expand Down

0 comments on commit 3f72351

Please sign in to comment.