Datasets:
File size: 2,346 Bytes
210fc07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
diff --git a/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala b/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
index 1b651004..d0492154 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
@@ -840,6 +840,58 @@ class RewriteTest extends FunSuite {
runApplyUpdate(update, original, expected)
}
+ test("issue-2877: sbt using same version in a val and a literal using a Seq addition") {
+ val update = ("org.scalatest".g % Nel.of(
+ "scalatest".a,
+ "scalactic".a
+ ) % "3.2.13" %> "3.2.14").group
+ val original = Map(
+ "build.sbt" ->
+ """
+ |val ScalaTestVersion = "3.2.13"
+ |libraryDependencies ++= Seq(
+ | "org.scalatest" %% "scalatest" % ScalaTestVersion,
+ | "org.scalatest" %% "scalactic" % "3.2.13"
+ |)
+ |""".stripMargin
+ )
+ val expected = Map(
+ "build.sbt" ->
+ """
+ |val ScalaTestVersion = "3.2.14"
+ |libraryDependencies ++= Seq(
+ | "org.scalatest" %% "scalatest" % ScalaTestVersion,
+ | "org.scalatest" %% "scalactic" % "3.2.14"
+ |)
+ |""".stripMargin
+ )
+ runApplyUpdate(update, original, expected)
+ }
+
+ test("issue-2877: sbt using same version in a val and a literal using individual additions") {
+ val update = ("org.scalatest".g % Nel.of(
+ "scalatest".a,
+ "scalactic".a
+ ) % "3.2.13" %> "3.2.14").group
+ val original = Map(
+ "build.sbt" ->
+ """
+ |val ScalaTestVersion = "3.2.13"
+ |libraryDependencies += "org.scalatest" %% "scalatest" % ScalaTestVersion
+ |libraryDependencies += "org.scalatest" %% "scalactic" % "3.2.13"
+ |""".stripMargin
+ )
+ val expected = Map(
+ "build.sbt" ->
+ """
+ |val ScalaTestVersion = "3.2.14"
+ |libraryDependencies += "org.scalatest" %% "scalatest" % ScalaTestVersion
+ |libraryDependencies += "org.scalatest" %% "scalactic" % "3.2.14"
+ |""".stripMargin
+ )
+ runApplyUpdate(update, original, expected)
+ }
+
private def runApplyUpdate(
update: Update.Single,
files: Map[String, String],
|