From 4f7767c022ff1aba7aed9c4c9c3f7abe5e286c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20P=C3=A1ll=20Geirsson?= Date: Sat, 24 Aug 2019 21:37:35 -0700 Subject: [PATCH 1/2] Add support for Scala 2.13. Disables `mdoc:js` support for 2.13 because scalajs-tools_2.13:0.6.28 is not published on Maven Central. --- .travis.yml | 4 +- build.sbt | 74 ++++++++++++++----- .../mdoc/modifiers/JsConfig.scala | 0 .../mdoc/modifiers/JsModifier.scala | 0 .../mdoc/modifiers/JsMods.scala | 0 .../scala/mdoc/internal/cli/MainOps.scala | 2 +- .../internal/markdown/MarkdownCompiler.scala | 1 + .../mdoc/internal/pos/TokenEditDistance.scala | 1 + project/plugins.sbt | 2 +- project/project/plugins.sbt | 2 +- .../tests/markdown/EvilplotPostModifier.scala | 9 +++ .../tests/markdown/JsModifier.scala | 6 ++ .../tests/markdown/EvilplotPostModifier.scala | 0 .../tests/markdown/JsModsSuite.scala | 0 .../tests/markdown/JsSuite.scala | 0 .../tests/markdown/PostModifierSuite.scala | 13 ---- .../tests/markdown/EvilplotPostModifier.scala | 9 +++ .../tests/markdown/JsModifier.scala | 6 ++ .../scala/tests/markdown/AsyncSuite.scala | 17 ++++- .../tests/markdown/BaseMarkdownSuite.scala | 10 ++- .../tests/markdown/BulletPostModifier.scala | 17 +++++ .../test/scala/tests/markdown/Compat.scala | 25 ++++++- .../scala/tests/markdown/ErrorSuite.scala | 12 +++ .../markdown/MarkdownCompilerSuite.scala | 19 ++++- 24 files changed, 184 insertions(+), 45 deletions(-) rename mdoc-js/src/main/{scala => scala-2.12}/mdoc/modifiers/JsConfig.scala (100%) rename mdoc-js/src/main/{scala => scala-2.12}/mdoc/modifiers/JsModifier.scala (100%) rename mdoc-js/src/main/{scala => scala-2.12}/mdoc/modifiers/JsMods.scala (100%) create mode 100644 tests/unit/src/test/scala-2.11/tests/markdown/EvilplotPostModifier.scala create mode 100644 tests/unit/src/test/scala-2.11/tests/markdown/JsModifier.scala rename tests/unit/src/test/{scala => scala-2.12}/tests/markdown/EvilplotPostModifier.scala (100%) rename tests/unit/src/test/{scala => scala-2.12}/tests/markdown/JsModsSuite.scala (100%) rename tests/unit/src/test/{scala => scala-2.12}/tests/markdown/JsSuite.scala (100%) rename tests/unit/src/test/{scala => scala-2.12}/tests/markdown/PostModifierSuite.scala (76%) create mode 100644 tests/unit/src/test/scala-2.13/tests/markdown/EvilplotPostModifier.scala create mode 100644 tests/unit/src/test/scala-2.13/tests/markdown/JsModifier.scala create mode 100644 tests/unit/src/test/scala/tests/markdown/BulletPostModifier.scala diff --git a/.travis.yml b/.travis.yml index 0cf58c793..4c5d1e550 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,10 @@ jobs: # default stage is test - env: TEST="scalafmt" script: ./bin/scalafmt --test + - env: TEST="Scala 2.13" + script: sbt ++2.13.0 test - env: TEST="Scala 2.12" - script: sbt test plugin/scripted + script: sbt ++2.12.9 test plugin/scripted - env: TEST="Scala 2.11" script: sbt ++2.11.12 test - env: TEST="Java 11" diff --git a/build.sbt b/build.sbt index b7c2742f3..62197d581 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,10 @@ -def scala212 = "2.12.8" +def scala212 = "2.12.9" def scala211 = "2.11.12" +def scala213 = "2.13.0" inThisBuild( List( scalaVersion := scala212, - crossScalaVersions := List(scala212, scala211), + crossScalaVersions := List(scala212, scala211, scala213), scalacOptions ++= List( "-Xexperimental", "-deprecation" @@ -27,6 +28,7 @@ inThisBuild( url("https://geirsson.com") ) ), + resolvers += Resolver.sonatypeRepo("public"), // faster publishLocal: publishArtifact.in(packageDoc) := sys.env.contains("CI"), publishArtifact.in(packageSrc) := sys.env.contains("CI") @@ -38,7 +40,17 @@ skip in publish := true crossScalaVersions := Nil val V = new { - val scalameta = "4.1.0" + val scalameta = "4.2.2" +} + +lazy val pprintVersion = Def.setting { + if (scalaVersion.value.startsWith("2.11")) "0.5.4" + else "0.5.5" +} + +lazy val fansiVersion = Def.setting { + if (scalaVersion.value.startsWith("2.11")) "0.2.6" + else "0.2.7" } lazy val runtime = project @@ -46,7 +58,7 @@ lazy val runtime = project moduleName := "mdoc-runtime", libraryDependencies ++= List( "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided, - "com.lihaoyi" %% "pprint" % "0.5.2" + "com.lihaoyi" %% "pprint" % pprintVersion.value ) ) @@ -73,9 +85,9 @@ lazy val mdoc = project "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0", "org.scala-lang" % "scala-compiler" % scalaVersion.value, "org.scalameta" %% "scalameta" % V.scalameta, - "com.geirsson" %% "metaconfig-typesafe-config" % "0.9.1", + "com.geirsson" %% "metaconfig-typesafe-config" % "0.9.4", "com.vladsch.flexmark" % "flexmark-all" % "0.40.4", - "com.lihaoyi" %% "fansi" % "0.2.5", + "com.lihaoyi" %% "fansi" % fansiVersion.value, "io.methvin" % "directory-watcher" % "0.8.0", "me.xdrop" % "fuzzywuzzy" % "1.1.10", // for link hygiene "did you mean?" // live reload @@ -93,14 +105,31 @@ lazy val testsInput = project skip in publish := true ) +val isScala213 = Def.setting { + VersionNumber(scalaVersion.value).matchesSemVer(SemanticSelector(">=2.13")) +} + +def scala212LibraryDependencies(deps: List[ModuleID]) = List( + libraryDependencies ++= { + if (isScala213.value) Nil + else deps + } +) + val jsdocs = project .in(file("tests/jsdocs")) .settings( skip in publish := true, scalaJSModuleKind := ModuleKind.CommonJSModule, + libraryDependencies ++= { + if (isScala213.value) Nil + else + List( + "in.nvilla" %%% "monadic-html" % "0.4.0-RC1" + ) + }, libraryDependencies ++= List( - "in.nvilla" %%% "monadic-html" % "0.4.0-RC1", - "org.scala-js" %%% "scalajs-dom" % "0.9.6" + "org.scala-js" %%% "scalajs-dom" % "0.9.7" ), scalaJSUseMainModuleInitializer := true, npmDependencies in Compile ++= List( @@ -114,14 +143,17 @@ lazy val unit = project .in(file("tests/unit")) .settings( skip in publish := true, - addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.8"), + addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3"), resolvers += Resolver.bintrayRepo("cibotech", "public"), + scala212LibraryDependencies( + List( + "com.cibo" %% "evilplot" % "0.6.0" + ) + ), libraryDependencies ++= List( - "com.cibo" %% "evilplot" % "0.6.0", - "co.fs2" %% "fs2-core" % "0.10.4", - "org.scalacheck" %% "scalacheck" % "1.13.5" % Test, - "org.scalacheck" %% "scalacheck" % "1.13.5" % Test, - "org.scalatest" %% "scalatest" % "3.2.0-SNAP10" % Test, + "co.fs2" %% "fs2-core" % "1.1.0-M1", + "org.scalacheck" %% "scalacheck" % "1.14.0" % Test, + "org.scalatest" %% "scalatest" % "3.0.8" % Test, "org.scalameta" %% "testkit" % V.scalameta % Test ), // forking causes https://github.com/scalatest/scalatest/issues/556 @@ -144,8 +176,8 @@ lazy val plugin = project moduleName := "sbt-mdoc", libraryDependencies ++= List( "org.jsoup" % "jsoup" % "1.11.3", - "org.scalacheck" %% "scalacheck" % "1.13.5" % Test, - "org.scalameta" %% "testkit" % "4.0.0-M11" % Test + "org.scalacheck" %% "scalacheck" % "1.14.0" % Test, + "org.scalameta" %% "testkit" % V.scalameta % Test ), resourceGenerators.in(Compile) += Def.task { val out = @@ -174,9 +206,11 @@ lazy val js = project .in(file("mdoc-js")) .settings( moduleName := "mdoc-js", - libraryDependencies ++= List( - "org.scala-js" % "scalajs-compiler" % "0.6.26" cross CrossVersion.full, - "org.scala-js" %% "scalajs-tools" % "0.6.26" + scala212LibraryDependencies( + List( + "org.scala-js" % "scalajs-compiler" % "0.6.28" cross CrossVersion.full, + "org.scala-js" %% "scalajs-tools" % "0.6.28" + ) ) ) .dependsOn(mdoc) @@ -185,6 +219,7 @@ lazy val lsp = project .in(file("mdoc-lsp")) .settings( moduleName := "mdoc-lsp", + crossScalaVersions := List(scala212), libraryDependencies ++= List( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.5.0", "com.outr" %% "scribe" % "2.6.0", @@ -197,6 +232,7 @@ lazy val docs = project .in(file("mdoc-docs")) .settings( moduleName := "mdoc-docs", + crossScalaVersions := List(scala212), skip in publish := !scalaVersion.value.startsWith("2.12") || version.in(ThisBuild).value.endsWith("-SNAPSHOT"), diff --git a/mdoc-js/src/main/scala/mdoc/modifiers/JsConfig.scala b/mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsConfig.scala similarity index 100% rename from mdoc-js/src/main/scala/mdoc/modifiers/JsConfig.scala rename to mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsConfig.scala diff --git a/mdoc-js/src/main/scala/mdoc/modifiers/JsModifier.scala b/mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsModifier.scala similarity index 100% rename from mdoc-js/src/main/scala/mdoc/modifiers/JsModifier.scala rename to mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsModifier.scala diff --git a/mdoc-js/src/main/scala/mdoc/modifiers/JsMods.scala b/mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsMods.scala similarity index 100% rename from mdoc-js/src/main/scala/mdoc/modifiers/JsMods.scala rename to mdoc-js/src/main/scala-2.12/mdoc/modifiers/JsMods.scala diff --git a/mdoc/src/main/scala/mdoc/internal/cli/MainOps.scala b/mdoc/src/main/scala/mdoc/internal/cli/MainOps.scala index b187e8d67..c93b64121 100644 --- a/mdoc/src/main/scala/mdoc/internal/cli/MainOps.scala +++ b/mdoc/src/main/scala/mdoc/internal/cli/MainOps.scala @@ -183,7 +183,7 @@ final class MainOps( } def clearScreen(): Unit = { - print("\033[H\033[2J") + print("\u001b[H\u001b[2J") } def waitingForFileChanges(): Unit = { diff --git a/mdoc/src/main/scala/mdoc/internal/markdown/MarkdownCompiler.scala b/mdoc/src/main/scala/mdoc/internal/markdown/MarkdownCompiler.scala index 446157abc..0def93e62 100644 --- a/mdoc/src/main/scala/mdoc/internal/markdown/MarkdownCompiler.scala +++ b/mdoc/src/main/scala/mdoc/internal/markdown/MarkdownCompiler.scala @@ -16,6 +16,7 @@ import mdoc.internal.pos.PositionSyntax import mdoc.internal.pos.PositionSyntax._ import mdoc.internal.pos.TokenEditDistance import scala.collection.JavaConverters._ +import scala.collection.Seq import scala.meta._ import scala.meta.inputs.Input import scala.meta.inputs.Position diff --git a/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala b/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala index 8ca2d3021..031b01d07 100644 --- a/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala +++ b/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala @@ -3,6 +3,7 @@ package mdoc.internal.pos import difflib._ import difflib.myers.Equalizer import scala.annotation.tailrec +import scala.collection.Seq import scala.meta._ import mdoc.internal.pos.PositionSyntax._ diff --git a/project/plugins.sbt b/project/plugins.sbt index a4d4e4d82..f46c54dd8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ addSbtCoursier addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28") addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.14.0") libraryDependencies ++= List( "org.jsoup" % "jsoup" % "1.11.3", diff --git a/project/project/plugins.sbt b/project/project/plugins.sbt index 68f337ff8..a49cf9378 100644 --- a/project/project/plugins.sbt +++ b/project/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M9") +addSbtPlugin("io.get-coursier" % "sbt-coursier" % "2.0.0-RC3-3") diff --git a/tests/unit/src/test/scala-2.11/tests/markdown/EvilplotPostModifier.scala b/tests/unit/src/test/scala-2.11/tests/markdown/EvilplotPostModifier.scala new file mode 100644 index 000000000..127f1b7b2 --- /dev/null +++ b/tests/unit/src/test/scala-2.11/tests/markdown/EvilplotPostModifier.scala @@ -0,0 +1,9 @@ +package tests.markdown + +import mdoc.PostModifier +import mdoc.PostModifierContext + +class EvilplotPostModifier extends PostModifier { + val name = "evilplot" + def process(ctx: PostModifierContext): String = "" +} diff --git a/tests/unit/src/test/scala-2.11/tests/markdown/JsModifier.scala b/tests/unit/src/test/scala-2.11/tests/markdown/JsModifier.scala new file mode 100644 index 000000000..64d0c2c53 --- /dev/null +++ b/tests/unit/src/test/scala-2.11/tests/markdown/JsModifier.scala @@ -0,0 +1,6 @@ +package mdoc.modifiers + +class JsModifier extends mdoc.PreModifier { + val name: String = "js" + def process(ctx: mdoc.PreModifierContext): String = "" +} diff --git a/tests/unit/src/test/scala/tests/markdown/EvilplotPostModifier.scala b/tests/unit/src/test/scala-2.12/tests/markdown/EvilplotPostModifier.scala similarity index 100% rename from tests/unit/src/test/scala/tests/markdown/EvilplotPostModifier.scala rename to tests/unit/src/test/scala-2.12/tests/markdown/EvilplotPostModifier.scala diff --git a/tests/unit/src/test/scala/tests/markdown/JsModsSuite.scala b/tests/unit/src/test/scala-2.12/tests/markdown/JsModsSuite.scala similarity index 100% rename from tests/unit/src/test/scala/tests/markdown/JsModsSuite.scala rename to tests/unit/src/test/scala-2.12/tests/markdown/JsModsSuite.scala diff --git a/tests/unit/src/test/scala/tests/markdown/JsSuite.scala b/tests/unit/src/test/scala-2.12/tests/markdown/JsSuite.scala similarity index 100% rename from tests/unit/src/test/scala/tests/markdown/JsSuite.scala rename to tests/unit/src/test/scala-2.12/tests/markdown/JsSuite.scala diff --git a/tests/unit/src/test/scala/tests/markdown/PostModifierSuite.scala b/tests/unit/src/test/scala-2.12/tests/markdown/PostModifierSuite.scala similarity index 76% rename from tests/unit/src/test/scala/tests/markdown/PostModifierSuite.scala rename to tests/unit/src/test/scala-2.12/tests/markdown/PostModifierSuite.scala index af23f3cab..3f7be5aac 100644 --- a/tests/unit/src/test/scala/tests/markdown/PostModifierSuite.scala +++ b/tests/unit/src/test/scala-2.12/tests/markdown/PostModifierSuite.scala @@ -3,19 +3,6 @@ package tests.markdown import mdoc.PostModifier import mdoc.PostModifierContext -class BulletPostModifier extends PostModifier { - val name = "bullet" - override def process(ctx: PostModifierContext): String = { - ctx.lastValue match { - case n: Int => - 1.to(n).map(i => s"$i. Bullet").mkString("\n") - case els => - ctx.reporter.error(s"expected int runtime value. Obtained $els") - "" - } - } -} - class PostModifierSuite extends BaseMarkdownSuite { check( "basic", diff --git a/tests/unit/src/test/scala-2.13/tests/markdown/EvilplotPostModifier.scala b/tests/unit/src/test/scala-2.13/tests/markdown/EvilplotPostModifier.scala new file mode 100644 index 000000000..127f1b7b2 --- /dev/null +++ b/tests/unit/src/test/scala-2.13/tests/markdown/EvilplotPostModifier.scala @@ -0,0 +1,9 @@ +package tests.markdown + +import mdoc.PostModifier +import mdoc.PostModifierContext + +class EvilplotPostModifier extends PostModifier { + val name = "evilplot" + def process(ctx: PostModifierContext): String = "" +} diff --git a/tests/unit/src/test/scala-2.13/tests/markdown/JsModifier.scala b/tests/unit/src/test/scala-2.13/tests/markdown/JsModifier.scala new file mode 100644 index 000000000..64d0c2c53 --- /dev/null +++ b/tests/unit/src/test/scala-2.13/tests/markdown/JsModifier.scala @@ -0,0 +1,6 @@ +package mdoc.modifiers + +class JsModifier extends mdoc.PreModifier { + val name: String = "js" + def process(ctx: mdoc.PreModifierContext): String = "" +} diff --git a/tests/unit/src/test/scala/tests/markdown/AsyncSuite.scala b/tests/unit/src/test/scala/tests/markdown/AsyncSuite.scala index 64ee78d39..c75a0c7ed 100644 --- a/tests/unit/src/test/scala/tests/markdown/AsyncSuite.scala +++ b/tests/unit/src/test/scala/tests/markdown/AsyncSuite.scala @@ -56,7 +56,22 @@ class AsyncSuite extends BaseMarkdownSuite { | at repl.Session$App$.(timeout.md:11) | at repl.Session$App$.(timeout.md) | ... 1 more - """.stripMargin + |""".stripMargin, + "2.13" -> + """|error: timeout.md:4:1: Future timed out after [10 milliseconds] + |Await.result(Future(Thread.sleep(1000)), Duration("10ms")) + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |java.lang.ExceptionInInitializerError + | at repl.Session$.app(timeout.md:3) + |Caused by: java.util.concurrent.TimeoutException: Future timed out after [10 milliseconds] + | at scala.concurrent.impl.Promise$DefaultPromise.tryAwait0(Promise.scala:212) + | at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:225) + | at scala.concurrent.Await$.$anonfun$result$1(package.scala:200) + | at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:62) + | at scala.concurrent.Await$.result(package.scala:124) + | at repl.Session$App$.(timeout.md:11) + | ... 1 more + |""".stripMargin ) ) diff --git a/tests/unit/src/test/scala/tests/markdown/BaseMarkdownSuite.scala b/tests/unit/src/test/scala/tests/markdown/BaseMarkdownSuite.scala index 2efd8957e..21db1c8a9 100644 --- a/tests/unit/src/test/scala/tests/markdown/BaseMarkdownSuite.scala +++ b/tests/unit/src/test/scala/tests/markdown/BaseMarkdownSuite.scala @@ -38,6 +38,9 @@ abstract class BaseMarkdownSuite extends org.scalatest.FunSuite with DiffAsserti ) ) .withProperties(MdocProperties.default(PathIO.workingDirectory)) + + def postProcessObtained: Map[String, String => String] = Map.empty + def postProcessExpected: Map[String, String => String] = Map.empty private val myStdout = new ByteArrayOutputStream() private def newReporter(): ConsoleReporter = { new ConsoleReporter(new PrintStream(myStdout)) @@ -68,8 +71,11 @@ abstract class BaseMarkdownSuite extends org.scalatest.FunSuite with DiffAsserti val input = Input.VirtualFile(name + ".md", original) Markdown.toMarkdown(input, getMarkdownSettings(context), reporter, settings) assert(reporter.hasErrors, "Expected errors but reporter.hasErrors=false") - val obtainedErrors = fansi.Str(myStdout.toString).plainText.trimLineEnds - assertNoDiffOrPrintExpected(obtainedErrors, Compat(expected, compat)) + val obtainedErrors = Compat.postProcess( + fansi.Str(myStdout.toString).plainText.trimLineEnds, + postProcessObtained + ) + assertNoDiffOrPrintExpected(obtainedErrors, Compat(expected, compat, postProcessExpected)) } } diff --git a/tests/unit/src/test/scala/tests/markdown/BulletPostModifier.scala b/tests/unit/src/test/scala/tests/markdown/BulletPostModifier.scala new file mode 100644 index 000000000..28a2710f0 --- /dev/null +++ b/tests/unit/src/test/scala/tests/markdown/BulletPostModifier.scala @@ -0,0 +1,17 @@ +package tests.markdown + +import mdoc.PostModifier +import mdoc.PostModifierContext + +class BulletPostModifier extends PostModifier { + val name = "bullet" + override def process(ctx: PostModifierContext): String = { + ctx.lastValue match { + case n: Int => + 1.to(n).map(i => s"$i. Bullet").mkString("\n") + case els => + ctx.reporter.error(s"expected int runtime value. Obtained $els") + "" + } + } +} diff --git a/tests/unit/src/test/scala/tests/markdown/Compat.scala b/tests/unit/src/test/scala/tests/markdown/Compat.scala index 11190adfd..39513c087 100644 --- a/tests/unit/src/test/scala/tests/markdown/Compat.scala +++ b/tests/unit/src/test/scala/tests/markdown/Compat.scala @@ -4,8 +4,21 @@ import mdoc.internal.BuildInfo object Compat { def isScala212: Boolean = BuildInfo.scalaVersion.startsWith("2.12") - def apply(default: String, compat: Map[String, String]): String = { - compat + def postProcess(default: String, compat: Map[String, String => String]): String = { + val processor = compat + .get(BuildInfo.scalaVersion) + .orElse(compat.get(BuildInfo.scalaBinaryVersion)) + processor match { + case None => default + case Some(fn) => fn(default) + } + } + def apply( + default: String, + compat: Map[String, String], + postProcess: Map[String, String => String] = Map.empty + ): String = { + val result = compat .get(BuildInfo.scalaVersion) .orElse(compat.get(BuildInfo.scalaBinaryVersion)) .getOrElse( @@ -13,8 +26,16 @@ object Compat { case "2.11" => default .replaceAllLiterally("Predef.scala:288", "Predef.scala:230") + case "2.12" => + default + .replaceAllLiterally("package.scala:219", "package.scala:220") + case "2.13" => + default + .replaceAllLiterally("", "") + .replaceAllLiterally("Predef.scala:288", "Predef.scala:347") case _ => default } ) + this.postProcess(result, postProcess) } } diff --git a/tests/unit/src/test/scala/tests/markdown/ErrorSuite.scala b/tests/unit/src/test/scala/tests/markdown/ErrorSuite.scala index 37704ce5d..5a593cec3 100644 --- a/tests/unit/src/test/scala/tests/markdown/ErrorSuite.scala +++ b/tests/unit/src/test/scala/tests/markdown/ErrorSuite.scala @@ -2,6 +2,18 @@ package tests.markdown class ErrorSuite extends BaseMarkdownSuite { + override def postProcessObtained: Map[String, String => String] = Map( + "2.13" -> { old => + old.linesIterator.filterNot(_.startsWith("did you mean")).mkString("\n") + } + ) + + override def postProcessExpected: Map[String, String => String] = Map( + "2.13" -> { old => + old.linesIterator.filterNot(_.contains("(crash.md)")).mkString("\n") + } + ) + checkError( "crash", """ diff --git a/tests/unit/src/test/scala/tests/markdown/MarkdownCompilerSuite.scala b/tests/unit/src/test/scala/tests/markdown/MarkdownCompilerSuite.scala index 429e242d1..90e409c21 100644 --- a/tests/unit/src/test/scala/tests/markdown/MarkdownCompilerSuite.scala +++ b/tests/unit/src/test/scala/tests/markdown/MarkdownCompilerSuite.scala @@ -48,25 +48,36 @@ class MarkdownCompilerSuite extends FunSuite with DiffAssertions { """ |```scala |val x = 1.to(10) - |// x: Range.Inclusive = Range.Inclusive(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + |// x: Range.Inclusive = Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |``` |```scala |val y = x.length |// y: Int = 10 |``` - """.stripMargin, + """.stripMargin, compat = Map( "2.11" -> """ |```scala |val x = 1.to(10) - |// x: Range.Inclusive = Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + |// x: Range.Inclusive = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + |``` + |```scala + |val y = x.length + |// y: Int = 10 + |``` + |""".stripMargin, + "2.12" -> + """ + |```scala + |val x = 1.to(10) + |// x: Range.Inclusive = Range.Inclusive(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |``` |```scala |val y = x.length |// y: Int = 10 |``` - """.stripMargin + |""".stripMargin ) ) From a23b191fadd51b48bd7cefa52557719414996c30 Mon Sep 17 00:00:00 2001 From: Olafur Pall Geirsson Date: Sun, 25 Aug 2019 15:51:48 -0700 Subject: [PATCH 2/2] Quote sbt "++2.13.0 test" command on Travis. To avoid `lsp/test` on 2.13 --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c5d1e550..819cc0ef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,15 +10,15 @@ stages: jobs: include: # default stage is test - - env: TEST="scalafmt" + - name: Scalafmt script: ./bin/scalafmt --test - - env: TEST="Scala 2.13" - script: sbt ++2.13.0 test - - env: TEST="Scala 2.12" - script: sbt ++2.12.9 test plugin/scripted - - env: TEST="Scala 2.11" - script: sbt ++2.11.12 test - - env: TEST="Java 11" + - env: Scala 2.13 + script: sbt "++2.13.0 test" + - env: Scala 2.12 + script: sbt test plugin/scripted + - env: Scala 2.11 + script: sbt "++2.11.12 test" + - env: Scala 2.12 script: sbt test plugin/scripted jdk: openjdk11 - stage: release