Skip to content

Commit d0bccf7

Browse files
committed
Update circe to version 0.8.0
1 parent 00e7d5a commit d0bccf7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ releaseProcess := {
3939
}
4040

4141
val Versions = new {
42-
val circe = "0.7.0"
42+
val circe = "0.8.0"
4343
val config = "1.3.1"
4444
val discipline = "0.8"
4545
val scalaCheck = "0.13.5"
@@ -61,7 +61,7 @@ autoAPIMappings := true
6161
doctestTestFramework := DoctestTestFramework.ScalaTest
6262
doctestMarkdownEnabled := true
6363
doctestWithDependencies := false
64-
scalacOptions in (Compile,doc) := Seq(
64+
scalacOptions in (Compile, doc) := Seq(
6565
"-groups",
6666
"-implicits",
6767
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",

src/test/scala/io.github.jonas.circe.config/CirceConfigLaws.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ class CirceConfigLaws extends FlatSpec {
1818
.mapObject(_.filterKeys(_.nonEmpty).withJsons(normalize))
1919
.mapArray(_.map(normalize))
2020
.mapNumber(number => {
21+
def numberToDouble = {
22+
val double = number.toDouble
23+
if (double.isWhole)
24+
Some(Json.fromLong(double.toLong))
25+
else
26+
Json.fromDouble(double)
27+
}
2128
// Map to the three principal types supported by Typesafe Config: Int, Long or Double
2229
val json =
2330
number.toInt.map(Json.fromInt) orElse
2431
number.toLong.map(Json.fromLong) orElse
25-
Json.fromDouble(number.toDouble) getOrElse
32+
numberToDouble getOrElse
2633
Json.fromInt(42)
2734

2835
json.asNumber.get

0 commit comments

Comments
 (0)