Skip to content

Commit

Permalink
fix tests + scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Apr 6, 2020
1 parent eb537f2 commit 4fd3bc8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
6 changes: 5 additions & 1 deletion data/src/main/scala/ch.epfl.scala.index.data/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import java.nio.file.Path

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import ch.epfl.scala.index.data.bintray.{BintrayDownloadPoms, BintrayDownloadSbtPlugins, BintrayListPoms}
import ch.epfl.scala.index.data.bintray.{
BintrayDownloadPoms,
BintrayDownloadSbtPlugins,
BintrayListPoms
}
import ch.epfl.scala.index.data.central.CentralMissing
import ch.epfl.scala.index.data.cleanup.{GithubRepoExtractor, NonStandardLib}
import ch.epfl.scala.index.data.elastic.SeedElasticSearch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ class ArtifactMetaExtractor(paths: DataPaths) {

// For example: scala-compiler
case Some(ScalaTargetFromVersion) =>
SemanticVersion.tryParse(pom.version).map(
version =>
ArtifactMeta(
artifactName = pom.artifactId,
scalaTarget = Some(ScalaJvm.fromFullVersion(version)),
isNonStandard = true
SemanticVersion
.tryParse(pom.version)
.map(
version =>
ArtifactMeta(
artifactName = pom.artifactId,
scalaTarget = Some(ScalaJvm.fromFullVersion(version)),
isNonStandard = true
)
)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ case class SemanticVersion(
}
}

object SemanticVersion extends Parsers with LazyLogging {
object SemanticVersion extends Parsers with LazyLogging {
implicit val ordering: Ordering[SemanticVersion] = Ordering.by { x =>
(x.major, x.minor, x.patch, x.patch2, x.preRelease)
}
Expand Down Expand Up @@ -93,13 +93,17 @@ object SemanticVersion extends Parsers with LazyLogging {
try {
fastparse.parse(version, x => FullParser(x)) match {
case Parsed.Success(v, _) => Some(v)
case _ =>
logger.warn(s"cannot parse ${classOf[SemanticVersion].getSimpleName} $version")
case _ =>
logger.warn(
s"cannot parse ${classOf[SemanticVersion].getSimpleName} $version"
)
None
}
} catch {
case NonFatal(_) =>
logger.warn(s"cannot parse ${classOf[SemanticVersion].getSimpleName} $version")
logger.warn(
s"cannot parse ${classOf[SemanticVersion].getSimpleName} $version"
)
None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ object SbtPlugin {
private def stableBinaryVersions = Set(`0.13`, `1.0`, `1.x`)

def isValid(version: BinaryVersion): Boolean = {
stableBinaryVersions.contains(version)
stableBinaryVersions.contains(version)
}
}

Expand All @@ -140,7 +140,8 @@ object ScalaTarget extends Parsers {
] {
case ScalaJvm(version) => (Jvm, version, None)
case ScalaJs(version, jsVersion) => (Js, jsVersion, Some(version))
case ScalaNative(version, nativeVersion) => (Native, nativeVersion, Some(version))
case ScalaNative(version, nativeVersion) =>
(Native, nativeVersion, Some(version))
case SbtPlugin(version, sbtVersion) => (Sbt, sbtVersion, Some(version))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class BinaryVersionTests
(MajorBinary(1), PreReleaseBinary(2, 0, None, Milestone(1)))
)

forAll(inputs) { (lower, higher) => lower shouldBe < (higher)}
forAll(inputs) { (lower, higher) =>
lower shouldBe <(higher)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class SemanticVersionTests extends FunSpec with Matchers {
}

it("major.minor.patch") {
SemanticVersion.tryParse("1.2.3") should contain(SemanticVersion(1, 2, 3))
SemanticVersion.tryParse("1.2.3") should contain(
SemanticVersion(1, 2, 3)
)
}

// relaxed semantic version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class ScalaTargetTests
val expected = List(
ScalaNative(s211, nat03),
ScalaJs(s210, js067),
ScalaJs(s210, js0618),
ScalaJs(s211, js067),
ScalaJs(s210, js0618),
ScalaJs(s211, js0618),
ScalaJs(s212, js0618),
ScalaJvm(s210),
Expand Down

0 comments on commit 4fd3bc8

Please sign in to comment.