Skip to content

Commit f4404ad

Browse files
author
Arnaud Gourlay
committed
format test code
1 parent 11f1a32 commit f4404ad

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

core/src/test/scala/gnieh/diffson/TestSerialization.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,15 @@ abstract class TestSerialization[JsValue, Instance <: DiffsonInstance[JsValue]](
7878
Add(Pointer("c"), marshall("test2")),
7979
Test(Pointer("d"), marshall(false)),
8080
Copy(Pointer("c"), Pointer("e")),
81-
Move(Pointer("d"), Pointer("f", "g"))
82-
)
81+
Move(Pointer("d"), Pointer("f", "g")))
8382

8483
val jsonRemember = JsonPatch(
8584
Replace(Pointer("a"), marshall(6), Some(marshall(5))),
8685
Remove(Pointer("b"), Some(marshall("removed value"))),
8786
Add(Pointer("c"), marshall("test2")),
8887
Test(Pointer("d"), marshall(false)),
8988
Copy(Pointer("c"), Pointer("e")),
90-
Move(Pointer("d"), Pointer("f", "g"))
91-
)
89+
Move(Pointer("d"), Pointer("f", "g")))
9290

9391
"a patch json" should "be correctly deserialized from a Json object" in {
9492
unmarshall[JsonPatch](parsed) should be(json)

core/src/test/scala/gnieh/diffson/conformance/TestRfcConformance.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ abstract class TestRfcConformance[JsValue, Instance <: DiffsonInstance[JsValue]]
2727

2828
trait ConformanceTest
2929

30-
case class SuccessConformanceTest(doc: JsValue,
30+
case class SuccessConformanceTest(
31+
doc: JsValue,
3132
patch: JsArray,
3233
expected: Option[JsValue],
3334
comment: Option[String],
3435
disabled: Option[Boolean]) extends ConformanceTest
3536

36-
case class ErrorConformanceTest(doc: JsValue,
37+
case class ErrorConformanceTest(
38+
doc: JsValue,
3739
patch: JsArray,
3840
error: String,
3941
comment: Option[String],
@@ -43,7 +45,7 @@ abstract class TestRfcConformance[JsValue, Instance <: DiffsonInstance[JsValue]]
4345

4446
def load(path: String): List[ConformanceTest]
4547

46-
def scalatest(t: ConformanceTest) = t match {
48+
def scalatest(t: ConformanceTest) = t match {
4749
case SuccessConformanceTest(doc, patch, Some(expected), comment, Some(true)) =>
4850
ignore(comment.getOrElse(f"$doc patched with $patch")) {
4951
val p = JsonPatch(patch)

playJson/src/test/scala/gnieh/diffson/conformance/PlayConformance.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ class PlayConformance extends TestRfcConformance[JsValue, PlayJsonInstance](play
3333
(JsPath \ "patch").read[JsArray] and
3434
(JsPath \ "expected").readNullable[JsValue] and
3535
(JsPath \ "comment").readNullable[String] and
36-
(JsPath \ "disabled").readNullable[Boolean]
37-
)(SuccessConformanceTest.apply _)
36+
(JsPath \ "disabled").readNullable[Boolean])(SuccessConformanceTest.apply _)
3837

3938
implicit lazy val errorConformanceTestUnmarshaller: Reads[ErrorConformanceTest] = (
4039
(JsPath \ "doc").read[JsValue] and
4140
(JsPath \ "patch").read[JsArray] and
4241
(JsPath \ "error").read[String] and
4342
(JsPath \ "comment").readNullable[String] and
44-
(JsPath \ "disabled").readNullable[Boolean]
45-
)(ErrorConformanceTest.apply _)
43+
(JsPath \ "disabled").readNullable[Boolean])(ErrorConformanceTest.apply _)
4644

4745
implicit lazy val commentConformanceTestUnMarshaller: Reads[CommentConformanceTest] =
4846
(JsPath \ "comment").read[String].map(CommentConformanceTest)

playJson/src/test/scala/gnieh/diffson/playJson/TestProtocol.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ trait TestProtocol {
1717
(JsPath \ "a").write[Int] and
1818
(JsPath \ "b").write[Boolean] and
1919
(JsPath \ "c").write[String] and
20-
(JsPath \ "d").write[List[Int]]
21-
)(unlift(test.Json.unapply))
20+
(JsPath \ "d").write[List[Int]])(unlift(test.Json.unapply))
2221
implicit def testJsonUnmarshaller: Reads[test.Json] = (
2322
(JsPath \ "a").read[Int] and
2423
(JsPath \ "b").read[Boolean] and
2524
(JsPath \ "c").read[String] and
26-
(JsPath \ "d").read[List[Int]]
27-
)(test.Json.apply _)
25+
(JsPath \ "d").read[List[Int]])(test.Json.apply _)
2826
}

0 commit comments

Comments
 (0)