-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and refactor SBT version logic (#710)
- Loading branch information
Showing
4 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/unit/src/test/scala/tests/SbtSupportedVersionsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package tests | ||
|
||
import com.sourcegraph.scip_java.buildtools.SbtBuildTool | ||
import com.sourcegraph.scip_java.buildtools.SbtVersionParser | ||
|
||
class SbtVersionParserSuite extends munit.FunSuite { | ||
test("parsing sbt versions") { | ||
import SbtVersionParser.{versionSegments => parse} | ||
assertEquals(parse("1.9.7"), List(1, 9, 7)) | ||
assertEquals(parse("1.10.0"), List(1, 10, 0)) | ||
assertEquals(parse("1.10.0-RC1"), List(1, 10, 0)) | ||
assertEquals(parse("0.13.17"), List(0, 13, 17)) | ||
assertEquals(parse("0.13"), List(0, 13)) | ||
} | ||
|
||
test("supported sbt versions") { | ||
import SbtBuildTool.{isSupportedSbtVersion => check} | ||
|
||
def checkSupported(version: String) = { | ||
assert(check(version).contains(true), check(version)) | ||
} | ||
|
||
def checkUnsupported(version: String) = { | ||
assert(check(version).contains(false), check(version)) | ||
} | ||
|
||
def checkFailed(version: String) = { | ||
assert(check(version).isLeft, check(version)) | ||
} | ||
|
||
checkSupported("1.10.0-RC1") | ||
checkSupported("0.13.17") | ||
checkSupported("1.5.6") | ||
checkSupported("1.9.7") | ||
|
||
checkUnsupported("1.0.0-RC1") | ||
checkUnsupported("0.13.16") | ||
checkUnsupported("1.1.6") | ||
checkUnsupported("0.12.15") | ||
|
||
checkFailed("1.0-RC1") | ||
checkFailed("0.13") | ||
checkFailed("BLA") | ||
checkFailed("") | ||
} | ||
|
||
} |