Skip to content

Commit

Permalink
Add test for semver metadata in version string
Browse files Browse the repository at this point in the history
This test checks whether the plugin correctly handles
dependencies where the version contains a + character. The
character is commonly used in semver version strings to add
build metadata to the version. Per https://semver.org/

Currently this test fails as the plugin is comparing the
following version strings that do not match:

7.2.27+33-04a1ea9e-SNAPSHOT
7.2.27%2B33-04a1ea9e-SNAPSHOT

Reproduces: cb372#110
  • Loading branch information
andyjayne committed Nov 30, 2023
1 parent fb638fc commit f64a275
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sbt-test/basic/semver-metadata/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scalaVersion := sys.props("scala.version")
resolvers ++= Seq("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.2.27+33-04a1ea9e-SNAPSHOT"
)
1 change: 1 addition & 0 deletions src/sbt-test/basic/semver-metadata/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % sys.props("plugin.version"))
10 changes: 10 additions & 0 deletions src/sbt-test/basic/semver-metadata/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import scalaz._
import scalaz.std.anyVal._
import scalaz.std.list._
import scalaz.std.option._
import scalaz.syntax.equal._

object Main {
val list1: List[Option[Int]] = List(Some(1), Some(2), Some(3), Some(4))
assert(Traverse[List].sequence(list1) === Some(List(1,2,3,4)))
}
2 changes: 2 additions & 0 deletions src/sbt-test/basic/semver-metadata/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> unusedCompileDependenciesTest
> undeclaredCompileDependenciesTest

0 comments on commit f64a275

Please sign in to comment.