Skip to content

Commit

Permalink
Update scalafmt-core to 2.1.0 (#69)
Browse files Browse the repository at this point in the history
* Update scalafmt-core to 2.1.0

* Formatting changes
  • Loading branch information
scala-steward authored and raboof committed Oct 1, 2019
1 parent daab083 commit b82696f
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 2.0.1
version = 2.1.0

maxColumn = 120
docstrings = JavaDoc
Expand Down
176 changes: 88 additions & 88 deletions src/test/scala/com/lightbend/paradox/apidoc/ApidocDirectiveSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,114 +66,114 @@ class ApidocDirectiveSpec extends MarkdownBaseSpec {
)

"Apidoc directive" should "generate markdown correctly when there is only one match" in {
markdown("@apidoc[Envelope]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/dispatch/Envelope.html">Envelope</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/dispatch/Envelope.html">Envelope</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[Envelope]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/dispatch/Envelope.html">Envelope</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/dispatch/Envelope.html">Envelope</a></span>
|</p>""".stripMargin
)
}

it should "throw an exception when there is no match" in {
val thrown = the[IllegalStateException] thrownBy markdown("@apidoc[ThereIsNoSuchClass]")
thrown.getMessage shouldEqual
"No matches found for ThereIsNoSuchClass"
}
val thrown = the[IllegalStateException] thrownBy markdown("@apidoc[ThereIsNoSuchClass]")
thrown.getMessage shouldEqual
"No matches found for ThereIsNoSuchClass"
}

it should "generate markdown correctly when 2 matches found and their package names include javadsl/scaladsl" in {
markdown("@apidoc[Flow]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Flow.html">Flow</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Flow.html">Flow</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[Flow]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Flow.html">Flow</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Flow.html">Flow</a></span>
|</p>""".stripMargin
)
}

it should "allow linking to a typed class that is also present in classic" in {
markdown("@apidoc[typed.*.Replicator$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/ddata/typed/scaladsl/Replicator$.html">Replicator</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/ddata/typed/javadsl/Replicator.html">Replicator</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[typed.*.Replicator$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/ddata/typed/scaladsl/Replicator$.html">Replicator</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/ddata/typed/javadsl/Replicator.html">Replicator</a></span>
|</p>""".stripMargin
)
}

it should "allow linking to a classic class that is also present in typed" in {
markdown("@apidoc[ddata.Replicator$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/ddata/Replicator$.html">Replicator</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/ddata/Replicator.html">Replicator</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[ddata.Replicator$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/ddata/Replicator$.html">Replicator</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/ddata/Replicator.html">Replicator</a></span>
|</p>""".stripMargin
)
}

it should "throw an exception when two matches found but javadsl/scaladsl is not in their packages" in {
val thrown = the[IllegalStateException] thrownBy markdown("@apidoc[ActorRef]")
thrown.getMessage shouldEqual
"2 matches found for ActorRef, but not javadsl/scaladsl: akka.actor.ActorRef, akka.actor.typed.ActorRef. You may want to use the fully qualified class name as @apidoc[fqcn] instead of @apidoc[ActorRef]."
}
val thrown = the[IllegalStateException] thrownBy markdown("@apidoc[ActorRef]")
thrown.getMessage shouldEqual
"2 matches found for ActorRef, but not javadsl/scaladsl: akka.actor.ActorRef, akka.actor.typed.ActorRef. You may want to use the fully qualified class name as @apidoc[fqcn] instead of @apidoc[ActorRef]."
}

it should "generate markdown correctly when fully qualified class name (fqcn) is specified as @apidoc[fqcn]" in {
markdown("@apidoc[akka.actor.ActorRef]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/actor/ActorRef.html">ActorRef</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/actor/ActorRef.html">ActorRef</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[akka.actor.ActorRef]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/actor/ActorRef.html">ActorRef</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/actor/ActorRef.html">ActorRef</a></span>
|</p>""".stripMargin
)
}

it should "find a class by partiql fqdn" in {
markdown("@apidoc[actor.typed.ActorRef]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/actor/typed/ActorRef.html">ActorRef</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/actor/typed/ActorRef.html">ActorRef</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[actor.typed.ActorRef]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/actor/typed/ActorRef.html">ActorRef</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/actor/typed/ActorRef.html">ActorRef</a></span>
|</p>""".stripMargin
)
}

it should "generate markdown correctly for a companion object" in {
markdown("@apidoc[ClusterClient$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/client/ClusterClient$.html">ClusterClient</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/client/ClusterClient.html">ClusterClient</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[ClusterClient$]") shouldEqual
html(
"""<p><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/cluster/client/ClusterClient$.html">ClusterClient</a></span><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/cluster/client/ClusterClient.html">ClusterClient</a></span>
|</p>""".stripMargin
)
}

it should "generate markdown correctly for type parameter and wildcard" in {
markdown("@apidoc[Source[ServerSentEvent, \\_]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Source.html">Source&lt;ServerSentEvent, ?&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Source.html">Source[ServerSentEvent, _]</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[Source[ServerSentEvent, \\_]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Source.html">Source&lt;ServerSentEvent, ?&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Source.html">Source[ServerSentEvent, _]</a></span>
|</p>""".stripMargin
)
}

it should "generate markdown correctly for type parameters with concrete names" in {
markdown("@apidoc[Flow[Message, Message, Mat]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Flow.html">Flow&lt;Message, Message, Mat&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Flow.html">Flow[Message, Message, Mat]</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[Flow[Message, Message, Mat]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka/2.5/?akka/stream/javadsl/Flow.html">Flow&lt;Message, Message, Mat&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/Flow.html">Flow[Message, Message, Mat]</a></span>
|</p>""".stripMargin
)
}

it should "generate markdown correctly for nested type parameters" in {
markdown("@apidoc[Marshaller[Try[A], B]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka-http/current/?akka/http/javadsl/marshalling/Marshaller.html">Marshaller&lt;Try&lt;A&gt;, B&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka-http/current/akka/http/scaladsl/marshalling/Marshaller.html">Marshaller[Try[A], B]</a></span>
|</p>""".stripMargin
)
}
markdown("@apidoc[Marshaller[Try[A], B]]") shouldEqual
html(
"""<p><span class="group-java">
|<a href="https://doc.akka.io/japi/akka-http/current/?akka/http/javadsl/marshalling/Marshaller.html">Marshaller&lt;Try&lt;A&gt;, B&gt;</a></span><span class="group-scala">
|<a href="https://doc.akka.io/api/akka-http/current/akka/http/scaladsl/marshalling/Marshaller.html">Marshaller[Try[A], B]</a></span>
|</p>""".stripMargin
)
}
}

0 comments on commit b82696f

Please sign in to comment.