Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lintable expansion #161

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
val scala211 = "2.11.12"
val scala212 = "2.12.15"
val scala213 = "2.13.8"
val scala212 = "2.12.19"
val scala213 = "2.13.14"
val scala3 = "3.1.2"
val scalaFull = Seq(scala213, scala212, scala211, scala3)
val scalaFull = Seq(scala213, scala212, /*scala211,*/ scala3)
ThisBuild / scalaVersion := scala213
Global / semanticdbEnabled := true
Global / semanticdbVersion := "4.5.0"
Global / semanticdbVersion := "4.9.3"

lazy val verify = "com.eed3si9n.verify" %% "verify" % "1.0.0"

Expand Down
4 changes: 2 additions & 2 deletions jvm/src/test/scala/org/expecty/ExpectyRenderingSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExpectyRenderingSpec {

@Test
def object_apply(): Unit = {
if (Compat.scala == "3.0" || Compat.scala == "2.13") {
if (Compat.scala == "3.0") {
outputs("""assertion failed

List() == List(1, 2)
Expand Down Expand Up @@ -70,7 +70,7 @@ List() == List(1, 2)

@Test
def object_apply_2(): Unit = {
if (Compat.scala == "3.0" || Compat.scala == "2.13") {
if (Compat.scala == "3.0") {
outputs("""assertion failed

List(1, 2) == List()
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.12.0")
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.16.0")
val scalaNativeVersion =
Option(System.getenv("SCALANATIVE_VERSION")).getOrElse("0.4.9")
Option(System.getenv("SCALANATIVE_VERSION")).getOrElse("0.5.1")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0")
Expand Down
12 changes: 11 additions & 1 deletion src/main/scala-2/com/eed3si9n/expecty/RecorderMacro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,19 @@ Instrumented AST: ${showRaw(instrumented)}")
"""
)

// to avoid missing interpolator lint, turn "a$b" into "a" + "$" + "b"
val cleanSource = {
val N = source.length - 1
source.indexOf('$') match {
case -1 | N => q"$source"
case _ =>
val parts = source.split('$').toList
parts.tail.foldLeft(q"${parts.head}")((t, s) => q"""$t + "$$" + $s""")
}
}
Apply(
Select(Ident(termName(context)("$com_eed3si9n_expecty_recorderRuntime")), termName(context)("recordExpression")),
List(q"$source", q"$ast", instrumented, getSourceLocation)
List(cleanSource, q"$ast", instrumented, getSourceLocation)
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/RenderingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object RenderingTest extends verify.BasicTestSuite {
}

test("List.apply") {
if (Compat.scala == "3.0" || Compat.scala == "2.13") {
if (Compat.scala == "3.0") {
outputs("""assertion failed
List() == List(1, 2)
| | |
Expand All @@ -60,7 +60,7 @@ List() == List(1, 2)
}

test("List.apply2") {
if (Compat.scala == "3.0" || Compat.scala == "2.13") {
if (Compat.scala == "3.0") {
outputs("""assertion failed
List(1, 2) == List()
| | |
Expand Down
Loading