Skip to content

Commit

Permalink
fmt test sources
Browse files Browse the repository at this point in the history
  • Loading branch information
jdegoes committed Jan 18, 2022
1 parent b99eae0 commit 63b4c3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ object YamlEncoderSpec extends DefaultRunnableSpec {
)
},
test("sequence root") {
assert(Json.Arr(Json.Bool(true), Json.Bool(false), Json.Bool(true)).toYaml(YamlOptions.default.copy(lineBreak = LineBreak.UNIX)))(
assert(
Json
.Arr(Json.Bool(true), Json.Bool(false), Json.Bool(true))
.toYaml(YamlOptions.default.copy(lineBreak = LineBreak.UNIX))
)(
isRight(equalTo(""" - true
| - false
| - true
Expand Down Expand Up @@ -126,7 +130,7 @@ object YamlEncoderSpec extends DefaultRunnableSpec {
|""".stripMargin

case class Example(i: Int, d: Double, s: List[String], o: Option[Example])
object Example {
object Example {
implicit lazy val codec: JsonCodec[Example] = DeriveJsonCodec.gen[Example]
}
}
5 changes: 3 additions & 2 deletions zio-json/shared/src/test/scala/zio/json/CodecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.collection.immutable

object CodecSpec extends DefaultRunnableSpec {
case class RecursiveOption(i: Int, d: Double, s: List[String], o: Option[RecursiveOption])
object RecursiveOption {
object RecursiveOption {
implicit lazy val codec: JsonCodec[RecursiveOption] = DeriveJsonCodec.gen[RecursiveOption]
}

Expand All @@ -19,7 +19,8 @@ object CodecSpec extends DefaultRunnableSpec {
test("option in recursive structure") {
val expected = RecursiveOption(100, 0.25, List("a", "b"), Some(RecursiveOption(200, 0, Nil, None)))

val decoded = JsonCodec[RecursiveOption].decoder.decodeJson("""{"i":100,"d":0.25,"s":["a","b"],"o":{"i":200,"d":0,"s":[]}}""")
val decoded = JsonCodec[RecursiveOption].decoder
.decodeJson("""{"i":100,"d":0.25,"s":["a","b"],"o":{"i":200,"d":0,"s":[]}}""")

assertTrue(decoded.right.get == expected)
}
Expand Down

0 comments on commit 63b4c3b

Please sign in to comment.