Skip to content

Commit

Permalink
Merge pull request #132 from eikek/munit
Browse files Browse the repository at this point in the history
Convert tests to MUnit
  • Loading branch information
eikek authored Jun 5, 2021
2 parents 77cd4b2 + ad78919 commit 972c0c7
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 42 deletions.
6 changes: 2 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ lazy val noPublish = Seq(
)

val testSettings = Seq(
testFrameworks += new TestFramework("minitest.runner.Framework"),
libraryDependencies ++=
(Dependencies.miniTest ++
Dependencies.logback).map(_ % Test)
libraryDependencies ++= (Dependencies.munit ++ Dependencies.logback).map(_ % Test),
testFrameworks += new TestFramework("munit.Framework")
)

val buildInfoSettings = Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.github.eikek.calev._
import io.circe._
import io.circe.generic.semiauto._
import io.circe.syntax._
import minitest._
import munit._

object CalevCirceCodecTest extends SimpleTestSuite with CalevCirceCodec {
class CalevCirceCodecTest extends FunSuite with CalevCirceCodec {

def parseJson(str: String): Json =
parser.parse(str).fold(throw _, identity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import scala.concurrent.ExecutionContext

import cats.effect._
import com.github.eikek.calev.Dsl._
import minitest._
import munit._

object CalEventTest extends SimpleTestSuite {
class CalEventTest extends FunSuite {

implicit val CS: ContextShift[IO] = IO.contextShift(ExecutionContext.global)
val blocker = Blocker.liftExecutionContext(ExecutionContext.global)
Expand Down Expand Up @@ -55,9 +55,9 @@ object CalEventTest extends SimpleTestSuite {
test("nextElapse no millis") {
val ce = CalEvent.unsafe("*-*-* 0/2:0/10")
val ref = zdt(2020, 4, 2, 18, 31, 12).`with`(ChronoField.MILLI_OF_SECOND, 156)
assertEquals(ref.getNano, 156000000L)
assertEquals(ref.getNano, 156000000)
val next = ce.nextElapse(ref).get
assertEquals(next.getNano, 0L)
assertEquals(next.getNano, 0)
}

test("nextElapses ends") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.eikek.calev

import com.github.eikek.calev.Dsl._
import minitest._
import munit._

object ComponentTest extends SimpleTestSuite {
class ComponentTest extends FunSuite {

test("create components") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.github.eikek.calev
import scala.concurrent.ExecutionContext

import cats.effect._
import minitest._
import munit._

object TriggerDataTest extends SimpleTestSuite {
class TriggerDataTest extends FunSuite {
implicit val CS: ContextShift[IO] = IO.contextShift(ExecutionContext.global)

val resource = "trigger-data.txt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.eikek.calev

import minitest._
import munit._

object ValueTest extends SimpleTestSuite {
class ValueTest extends FunSuite {

test("contains (single values)") {
for (n <- 1 to 50) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.eikek.calev

import com.github.eikek.calev.Dsl._
import minitest._
import munit._

object WeekdayComponentTest extends SimpleTestSuite {
class WeekdayComponentTest extends FunSuite {

test("contains") {
for (wd <- Weekday.all) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.eikek.calev

import com.github.eikek.calev.Weekday._
import minitest._
import munit._

object WeekdayRangeTest extends SimpleTestSuite {
class WeekdayRangeTest extends FunSuite {

test("contains") {
assert(WeekdayRange(Mon, Wed).contains(Mon))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import java.time.LocalDateTime

import com.github.eikek.calev.CalEvent
import com.github.eikek.calev.internal.DefaultTrigger._
import minitest._
import munit._

object DefaultTriggerTest extends SimpleTestSuite {
class DefaultTriggerTest extends FunSuite {

val ce = CalEvent.unsafe("*-*-* 0/2:0")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.github.eikek.calev.internal

import com.github.eikek.calev.Dsl._
import com.github.eikek.calev._
import minitest._
import munit._

object ParserTest extends SimpleTestSuite {
class ParserTest extends FunSuite {

test("const") {
val p = Parser.const("ab")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import _root_.doobie._
import _root_.doobie.implicits._
import cats.effect._
import com.github.eikek.calev._
import minitest._
import munit._

object CalevDoobieTest extends SimpleTestSuite with CalevDoobieMeta {
class CalevDoobieTest extends FunSuite with CalevDoobieMeta {
implicit val CS: ContextShift[IO] = IO.contextShift(ExecutionContext.global)

val xa = Transactor.fromDriverManager[IO](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import scala.concurrent.ExecutionContext

import cats.effect._
import com.github.eikek.calev._
import minitest._
import munit._

object CalevFs2Test extends SimpleTestSuite {
class CalevFs2Test extends FunSuite {

implicit val timer: Timer[IO] = IO.timer(ExecutionContext.global)

Expand Down
26 changes: 12 additions & 14 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import sbt._

object Dependencies {

val circeVersion = "0.14.1"
val doobieVersion = "0.13.4"
val fs2Version = "2.5.6"
val h2Version = "1.4.200"
val log4sVersion = "1.8.2"
val logbackVersion = "1.2.3"
val miniTestVersion = "2.9.6"
val circeVersion = "0.14.1"
val doobieVersion = "0.13.4"
val fs2Version = "2.5.6"
val h2Version = "1.4.200"
val log4sVersion = "1.8.2"
val logbackVersion = "1.2.3"
val munitVersion = "0.7.26"

val munit = Seq(
"org.scalameta" %% "munit" % munitVersion,
"org.scalameta" %% "munit-scalacheck" % munitVersion
)

val fs2 = Seq(
"co.fs2" %% "fs2-core" % fs2Version
Expand All @@ -18,13 +23,6 @@ object Dependencies {
"co.fs2" %% "fs2-io" % fs2Version
)

val miniTest = Seq(
// https://github.com/monix/minitest
// Apache 2.0
"io.monix" %% "minitest" % miniTestVersion,
"io.monix" %% "minitest-laws" % miniTestVersion
)

// https://github.com/Log4s/log4s;ASL 2.0
val loggingApi = Seq(
"org.log4s" %% "log4s" % log4sVersion
Expand Down

0 comments on commit 972c0c7

Please sign in to comment.