Skip to content

Commit

Permalink
Updated tests for both jvm and js. Removed duplicated TimerSpec body.
Browse files Browse the repository at this point in the history
  • Loading branch information
aappddeevv committed May 1, 2017
1 parent 1272348 commit ae5402c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ project/plugins/project/
.worksheet

.idea

*~
.#~
36 changes: 20 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,29 @@ description := "a library of simple primitives for asynchronously retrying Scala
crossScalaVersions := Seq("2.10.5", "2.11.6", "2.12.1")
scalaVersion in ThisBuild := crossScalaVersions.value.last

val libs = Seq(
"me.lessis" %% "odelay-core" % "0.2.0",
"org.scalatest" %% "scalatest" % "3.0.1" % "test")
lsSettings

// remove me
resolvers += Resolver.file("Local", file( Path.userHome.absolutePath + "/.ivy2/local"))(Resolver.ivyStylePatterns)
val commonSettings = lsSettings ++ Seq(
LsKeys.tags in LsKeys.lsync := Seq("future", "retry"),
bintrayPackageLabels := (LsKeys.tags in LsKeys.lsync).value,
externalResolvers in LsKeys.lsync := (resolvers in bintray).value,
scalacOptions += "-feature",
resolvers += sbt.Resolver.bintrayRepo("softprops","maven")
)

lazy val retry = (crossProject in file ("."))
.settings(libraryDependencies ++= libs,
scalacOptions += "-feature")
.settings(commonSettings: _*)
.jvmSettings(
libraryDependencies ++=
Seq("org.scalatest" %% "scalatest" % "3.0.1" % "test",
"me.lessis" %% "odelay-core" % "0.2.0")
)
.jsSettings(
libraryDependencies ++=
Seq("org.scalatest" %%% "scalatest" % "3.0.1" % "test",
"me.lessis" %%% "odelay-core" % "0.2.0")
)


lazy val retryJs = retry.js
lazy val retryJvm = retry.jvm
Expand Down Expand Up @@ -48,12 +61,3 @@ pomExtra := (
</developer>
</developers>)

lsSettings

LsKeys.tags in LsKeys.lsync := Seq("future", "retry")

bintrayPackageLabels := (LsKeys.tags in LsKeys.lsync).value

resolvers += sbt.Resolver.bintrayRepo("softprops","maven")

externalResolvers in LsKeys.lsync := (resolvers in bintray).value
6 changes: 6 additions & 0 deletions js/src/test/scala/PolicySpecJS.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package retry

class PolicySpecJS extends PolicySpec {
implicit val timer = new odelay.js.JsTimer()
}

12 changes: 0 additions & 12 deletions jvm/src/test/scala/PolicySpec.scala

This file was deleted.

5 changes: 5 additions & 0 deletions jvm/src/test/scala/PolicySpecJVM.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package retry

class PolicySpecJVM extends PolicySpec {
implicit val timer = odelay.Timer.default
}
3 changes: 2 additions & 1 deletion shared/src/test/scala/JitterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import scala.concurrent.duration._
import language.postfixOps

class JitterSpec extends FunSpec {
val rng = new SecureRandom()
//val rng = new SecureRandom()
val rng = new java.util.Random()
val rand = Jitter.randomSource(rng)
val cap = 2000 milliseconds

Expand Down
5 changes: 2 additions & 3 deletions shared/src/test/scala/PolicySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import scala.concurrent.{ Future }
import scala.concurrent.duration._
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicInteger, AtomicLong }

class PolicySpec extends AsyncFunSpec with BeforeAndAfterAll {
abstract class PolicySpec extends AsyncFunSpec with BeforeAndAfterAll {

// needed so we do not get a scalatest EC error
implicit override def executionContext =
scala.concurrent.ExecutionContext.Implicits.global


val timer = implicitly[Timer]
implicit val timer: Timer
val random = new Random()
val randomSource = Jitter.randomSource(random)

Expand Down

0 comments on commit ae5402c

Please sign in to comment.