Skip to content

Commit

Permalink
Fix snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed May 20, 2024
1 parent 77f6267 commit 44c275c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ object ScipPrinters {
.append("signature_documentation ")
.append(info.getSignatureDocumentation.getLanguage)
.append(" ")
.append(info.getSignatureDocumentation.getText.replace("\n", "\\n").replace("\t", "\\t"))
.append(
info
.getSignatureDocumentation
.getText
.replace("\n", "\\n")
.replace("\t", "\\t")
)
.append("\n")
}
if (!info.getEnclosingSymbol.isEmpty) {
Expand All @@ -194,11 +200,7 @@ object ScipPrinters {
.append("\n")
}
if (info.getKind != Scip.SymbolInformation.Kind.UnspecifiedKind) {
out
.append(prefix)
.append("kind ")
.append(info.getKind)
.append("\n")
out.append(prefix).append("kind ").append(info.getKind).append("\n")
}
0.until(info.getDocumentationCount)
.foreach { n =>
Expand Down
33 changes: 27 additions & 6 deletions tests/unit/src/test/scala/tests/SnapshotCommandSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ class SnapshotCommandSuite extends MopedSuite(ScipJava.app) {
FileLayout.fromString(
"""/main/Sample.java
|package main;
|
| /**
| * Sample class
| */
|public class Sample {
| /**
| * Main application entry point
| */
| public static void main(String[] asdf) {}
|}
|""".stripMargin,
Expand All @@ -37,6 +42,7 @@ class SnapshotCommandSuite extends MopedSuite(ScipJava.app) {
targetroot.toString
)
)

assertEquals(indexExit, 0, clues(app.capturedOutput))

val snapshotExit = app().run(
Expand All @@ -47,18 +53,33 @@ class SnapshotCommandSuite extends MopedSuite(ScipJava.app) {
FileLayout.asString(generatedpath),
"""|/main/Sample.java
|package main;
|
| /**
| * Sample class
| */
|public class Sample {
|// ^^^^^^ definition semanticdb maven . . main/Sample#
|// documentation ```java\npublic class Sample\n```
|// display_name Sample
|// signature_documentation java public class Sample
|// kind Class
|// documentation Sample class\n
|// ^^^^^^ definition semanticdb maven . . main/Sample#`<init>`().
|// documentation ```java\npublic Sample()\n```
|// display_name <init>
|// signature_documentation java public Sample()
|// kind Constructor
| /**
| * Main application entry point
| */
| public static void main(String[] asdf) {}
|// ^^^^ definition semanticdb maven . . main/Sample#main().
|// documentation ```java\npublic static void main(String[] asdf)\n```
|// display_name main
|// signature_documentation java public static void main(String[] asdf)
|// kind StaticMethod
|// documentation Main application entry point\n
|// ^^^^^^ reference semanticdb maven jdk 11 java/lang/String#
|// ^^^^ definition local 0
|// documentation ```java\nString[] asdf\n```
|// display_name asdf
|// signature_documentation java String[] asdf
|// enclosing_symbol semanticdb maven . . main/Sample#main().
|}
|""".stripMargin
)
Expand Down

0 comments on commit 44c275c

Please sign in to comment.