Skip to content

Commit

Permalink
Test Show instance for Duration (#2215)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceedubs authored and johnynek committed Mar 26, 2018
1 parent f038f0c commit 0e24894
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/src/test/scala/cats/tests/DurationSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cats
package tests

import cats.instances.duration._
import cats.laws.discipline.SerializableTests

import scala.concurrent.duration.{Duration, DurationInt}

class DurationSuite extends CatsSuite {
checkAll("Show[Duration]", SerializableTests.serializable(Show[Duration]))

test("show works for FiniteDuration"){
Show[Duration].show(23.minutes) should ===("23 minutes")
}

test("show works for non-finite durations"){
Show[Duration].show(Duration.Inf) should ===("Duration.Inf")
Show[Duration].show(Duration.MinusInf) should ===("Duration.MinusInf")
Show[Duration].show(Duration.Undefined) should ===("Duration.Undefined")
}
}

0 comments on commit 0e24894

Please sign in to comment.