Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab committed Nov 14, 2023
1 parent ede00d1 commit ae2e195
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ out
.bloop
.vscode
.metals
.bsp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object ImportHookTests extends TestSuite{
@ import scalatags.Text.all._
error: ${check.notFound("scalatags")}

@ import $$ivy.`com.lihaoyi::scalatags:0.7.0 compat`
@ import $$ivy.`com.lihaoyi::scalatags:0.12.0`

@ import scalatags.Text.all._

Expand All @@ -96,7 +96,7 @@ object ImportHookTests extends TestSuite{
@ import scalatags.Text.all._
error: ${check.notFound("scalatags")}

@ import $$ivy.`com.lihaoyi:scalatags_$sbv:0.7.0`
@ import $$ivy.`com.lihaoyi:scalatags_$sbv:0.12.0`

@ import scalatags.Text.all._

Expand Down
8 changes: 4 additions & 4 deletions amm/repl/src/test/scala/ammonite/session/ProjectTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ object ProjectTests extends TestSuite{
}

test("no sources"){
val sbv = scala.util.Properties.versionNumberString.split('.').take(2).mkString(".")
val sbv = ammonite.compiler.CompilerBuilder.scalaVersion.split('.').take(2).mkString(".")

val core =
s"""
@ import $$ivy.`com.github.alexarchambault::case-app:2.0.0-M9 compat`
@ import $$ivy.`com.github.alexarchambault::case-app:2.1.0-M26`

@ val cp = {
@ repl.sess
Expand All @@ -440,7 +440,7 @@ object ProjectTests extends TestSuite{
@ }
cp: List[String] = ?

@ val found = cp.exists(_.endsWith("/case-app_$sbv-2.0.0-M9.jar"))
@ val found = cp.exists(_.endsWith("/case-app_$sbv-2.1.0-M26.jar"))
found: Boolean = true
"""

Expand All @@ -449,7 +449,7 @@ object ProjectTests extends TestSuite{
s"""
$core

@ val sourcesFound = cp.exists(_.endsWith("/case-app_$sbv-2.0.0-M9-sources.jar"))
@ val sourcesFound = cp.exists(_.endsWith("/case-app_$sbv-2.1.0-M26-sources.jar"))
sourcesFound: Boolean = true
"""
)
Expand Down
4 changes: 2 additions & 2 deletions amm/repl/src/test/scala/ammonite/unit/SourceTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ object SourceTests extends TestSuite{
test("stdLibScala"){
test("direct"){
val is2_13_3_orLower = {
val ver = scala.util.Properties.versionNumberString
!ver.startsWith("2.13.") ||
val ver = ammonite.compiler.CompilerBuilder.scalaVersion
!ver.startsWith("3.") || !ver.startsWith("2.13.") ||
scala.util.Try(ver.stripPrefix("2.13.").toInt).toOption.exists(_ <= 3)
}
check(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $ivy.`com.lihaoyi::some-dummy-library:0.2+ compat`
import $ivy.`com.lihaoyi::some-dummy-library:0.2+`

import io.circe._
val json = Json.obj("a" -> Json.True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $ivy.`com.lihaoyi::some-dummy-library:0.2+ compat`
import $ivy.`com.lihaoyi::some-dummy-library:0.2+`

import argonaut._
val json = Json.obj("a" -> Json.jTrue, "c" -> Json.jString("b"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $ivy.`com.lihaoyi::some-dummy-library:0.1-SNAPSHOT compat`
import $ivy.`com.lihaoyi::some-dummy-library:0.1-SNAPSHOT`

import io.circe._
val json = Json.obj("a" -> Json.True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $ivy.`com.lihaoyi::some-dummy-library:0.1-SNAPSHOT compat`
import $ivy.`com.lihaoyi::some-dummy-library:0.1-SNAPSHOT`

import argonaut._
val json = Json.obj("a" -> Json.jTrue, "c" -> Json.jString("b"))
Expand Down
8 changes: 5 additions & 3 deletions integration/src/test/resources/some-dummy-library/build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
val scalaV = sys.env("SCALA_VERSION")
val circeVersion = if(scalaV.startsWith("3.")) "0.14.6" else "0.12.0-M3"

lazy val root = (project in file(".")).
settings(
Expand All @@ -6,9 +8,9 @@ lazy val root = (project in file(".")).
version := sys.env("VERSION"),
scalaVersion := sys.env("SCALA_VERSION"),
libraryDependencies += {
if (java.lang.Boolean.parseBoolean(sys.env("FIRST_RUN")))
"io.circe" %% "circe-core" % "0.12.0-M3"
if (sys.env("FIRST_RUN").toBoolean)
"io.circe" %% "circe-core" % circeVersion
else
"io.argonaut" %% "argonaut" % "6.2.3"
"io.argonaut" %% "argonaut" % "6.2.6"
}
)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.9.6
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,13 @@ object BasicTests extends TestSuite{
// test disabled on windows because sbt not available
if (!Util.windowsPlatform) {
val buildRoot = os.pwd/"target"/"some-dummy-library"
os.makeDir.all(buildRoot)
os.copy.over(intTestResources/"some-dummy-library", buildRoot)
val dummyScala = buildRoot/"src"/"main"/"scala"/"dummy"/"Dummy.scala"
// using the same home to share the ivymap cache across runs
val home = os.temp.dir()

val sbv = scala.util.Properties.versionNumberString.split('.').take(2).mkString(".")
val sbv = ammonite.compiler.CompilerBuilder.scalaVersion.split('.').take(2).mkString(".")
val previous = os.home / ".ivy2" / "local" / "com.lihaoyi" / ("some-dummy-library_" + sbv)
os.remove.all(previous)

Expand All @@ -222,7 +223,7 @@ object BasicTests extends TestSuite{
os.proc("sbt", "-J-Xmx1g", "-batch", "-no-colors", "publishLocal").call(
env = Map(
"SCALA_VERSION" -> scalaVersion,
"FIRST_RUN" -> s"$firstRun",
"FIRST_RUN" -> firstRun.toString,
"VERSION" -> version
),
cwd = buildRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ object TestUtils {
executable,
extraAmmArgs,
if (thin) Seq("--thin") else Nil,
"--no-remote-logging",
"--home",
home,
replStandaloneResources / name,
Expand Down
1 change: 0 additions & 1 deletion readme/Sample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object Sample{
Seq(
sys.env.getOrElse("AMMONITE_ASSEMBLY", "amm"),
"--color", "true",
"--no-remote-logging",
"--no-home-predef",
),
s"${ammoniteCode.trim}\nexit\n",
Expand Down

0 comments on commit ae2e195

Please sign in to comment.