Skip to content

Commit

Permalink
Remove slf4j dependency (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial authored Nov 3, 2022
1 parent bc978a1 commit 24ee860
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
9 changes: 5 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ scriptedLaunchOpts ++= {
Seq("-Dplugin.version=" + version.value)
}

testFrameworks += new TestFramework("wvlet.airspec.Framework")

libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "2.0.3",
"org.apache.commons" % "commons-compress" % "1.22",
"org.tukaani" % "xz" % "1.9",
"org.specs2" %% "specs2-core" % "4.18.0" % "test"
"org.wvlet.airframe" %% "airspec" % "22.11.0" % Test,
"org.apache.commons" % "commons-compress" % "1.22",
"org.tukaani" % "xz" % "1.9"
)
61 changes: 32 additions & 29 deletions src/test/scala/xerial/sbt/VersionStringSpec.scala
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
package xerial.sbt

import org.specs2.mutable.Specification
import wvlet.airspec.AirSpec
import xerial.sbt.pack.{DefaultVersionStringOrdering, VersionString}

class VersionStringSpec extends Specification {
import scala.math.Ordered.orderingToOrdered

class VersionStringSpec extends AirSpec {
implicit val versionStringOrdering = DefaultVersionStringOrdering

"VersionString" should {
"accept any string" in {
test("VersionString") {
test("accept any string") {
VersionString("1.0")
VersionString("1.0-alpha")
VersionString("1")
VersionString("-alpha")
VersionString("1231892")
VersionString("asd;.a2,.-")

ok
}

"properly deconstruct arbitrary string" in {
VersionString("1") === VersionString.fromNumbers(1 :: Nil, None)
VersionString("1.2") === VersionString.fromNumbers(1 :: 2 :: Nil, None)
VersionString("1.2.3") === VersionString.fromNumbers(1 :: 2 :: 3 :: Nil, None)
VersionString("1.2.3.4") === VersionString.fromNumbers(1 :: 2 :: 3 :: 4 :: Nil, None)
VersionString("1.2.3.4-alpha") === VersionString.fromNumbers(1 :: 2 :: 3 :: 4 :: Nil, Some("alpha"))
VersionString("1.2.3.4-alpha-beta") === VersionString.fromNumbers(1 :: 2 :: 3 :: 4 :: Nil, Some("alpha-beta"))
VersionString("foo") === VersionString(List.empty[String], Some("foo"))
VersionString("foo.bar") === VersionString(List.empty[String], Some("foo.bar"))
VersionString("foo.bar-alpha") === VersionString(List.empty[String], Some("foo.bar-alpha"))
test("properly deconstruct arbitrary string") {
VersionString("1") shouldBe VersionString.fromNumbers(1 :: Nil, None)
VersionString("1.2") shouldBe VersionString.fromNumbers(1 :: 2 :: Nil, None)
VersionString("1.2.3") shouldBe VersionString.fromNumbers(1 :: 2 :: 3 :: Nil, None)
VersionString("1.2.3.4") shouldBe VersionString.fromNumbers(1 :: 2 :: 3 :: 4 :: Nil, None)
VersionString("1.2.3.4-alpha") shouldBe VersionString.fromNumbers(1 :: 2 :: 3 :: 4 :: Nil, Some("alpha"))
VersionString("1.2.3.4-alpha-beta") shouldBe VersionString.fromNumbers(
1 :: 2 :: 3 :: 4 :: Nil,
Some("alpha-beta")
)
VersionString("foo") shouldBe VersionString(List.empty[String], Some("foo"))
VersionString("foo.bar") shouldBe VersionString(List.empty[String], Some("foo.bar"))
VersionString("foo.bar-alpha") shouldBe VersionString(List.empty[String], Some("foo.bar-alpha"))
}

"properly sort" in {
VersionString("1") must be_<(VersionString("1.2.3.4"))
VersionString("2") must be_>(VersionString("1.2.3.4"))
VersionString("1.2.2") must be_<(VersionString("1.2.3.4"))
VersionString("1.2.4") must be_>(VersionString("1.2.3.4"))
VersionString("1.2.3.4.5") must be_>(VersionString("1.2.3.4"))
test("properly sort") {
VersionString("1") < VersionString("1.2.3.4") shouldBe true
VersionString("2") > VersionString("1.2.3.4") shouldBe true
VersionString("1.2.2") < VersionString("1.2.3.4") shouldBe true
VersionString("1.2.4") > VersionString("1.2.3.4") shouldBe true
VersionString("1.2.3.4.5") > VersionString("1.2.3.4") shouldBe true

VersionString("2.9.2") must be_<(VersionString("2.10.4"))
VersionString("2.9.2") < VersionString("2.10.4") shouldBe true

VersionString("1.2") must be_>(VersionString("1.2-alpha"))
VersionString("1.2-beta") must be_>(VersionString("1.2-alpha"))
VersionString("1.2") > VersionString("1.2-alpha") shouldBe true
VersionString("1.2-beta") > VersionString("1.2-alpha") shouldBe true

VersionString("apple") must be_<(VersionString("pie"))
VersionString("apple") < VersionString("pie") shouldBe true
}

"preserve 0-padding in version strings" in {
test("preserve 0-padding in version strings") {
val v = VersionString("1.09")
v.major mustEqual "1"
v.minor mustEqual Some("09")
v.major shouldBe "1"
v.minor shouldBe Some("09")
}
}
}

0 comments on commit 24ee860

Please sign in to comment.