Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.6 #398

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.6
c2a06b548ef49c853bf135e1a53addb6918d0b99
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.6
runner.dialect = scala213
continuationIndent.defnSite = 2
docstrings.style = Asterisk
Expand Down
33 changes: 11 additions & 22 deletions optics/src/test/scala/io/circe/optics/JsonPathSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,17 @@ class JsonPathSuite extends CirceSuite {
).asJson
)

"JsonPath" should "support traversal by field name" in {
"JsonPath" should "support traversal by field name" in
assert(root.address.street_number.int.getOption(john) === Some(12))
}

it should "return Some(None) when selected field doesn't exist" in {
it should "return Some(None) when selected field doesn't exist" in
assert(root.address.atAs[Int]("street_district").getOption(john) === Some(None))
}

it should "support traversal by array index" in {
it should "support traversal by array index" in
assert(root.cars.index(1).model.string.getOption(john) === Some("suv"))
}

it should "support traversal by array index using apply" in {
it should "support traversal by array index using apply" in
assert(root.cars(1).model.string.getOption(john) === Some("suv"))
}

it should "support traversal by array index using apply on the root" in {
val jsonArray = List("first".asJson, "second".asJson).asJson
Expand All @@ -71,33 +67,27 @@ class JsonPathSuite extends CirceSuite {
assert(root.at("foo").replace(Some(true.asJson))(john).asObject.flatMap(_.apply("foo")) === Some(Json.True))
}

it should "support codec" in {
it should "support codec" in
assert(root.cars.index(0).as[Car].getOption(john) === Some(Car("fancy", 120, automatic = false)))
}

"JsonTraversalPath" should "support traversal over each values of a json object" in {
"JsonTraversalPath" should "support traversal over each values of a json object" in
assert(root.each.string.getAll(john) === List("John", "Doe"))
}

it should "support traversal over each values of a json array" in {
it should "support traversal over each values of a json array" in
assert(root.cars.each.maxSpeed.int.getAll(john) === List(120, 80))
}

it should "support filtering by field of json object" in {
it should "support filtering by field of json object" in
assert(root.filterByField(_.contains("first")).string.getAll(john) === List("John"))
}

it should "support filtering by index of json array" in {
it should "support filtering by index of json array" in
assert(root.cars.filterByIndex(_ % 2 == 1).as[Car].getAll(john) === List(Car("suv", 80, automatic = true)))
}

it should "support a safe filtering by value" in {
it should "support a safe filtering by value" in
assert(
root.cars.each.filter(root.maxSpeed.int.exist(_ > 100)).model.string.getAll(john) === List("fancy")
)
}

it should "support an unsafe filtering by value" in {
it should "support an unsafe filtering by value" in
assert(
root.cars.each.filterUnsafe(root.maxSpeed.int.exist(_ > 100)).model.string.replace("new")(john) ===
Json.obj(
Expand All @@ -114,6 +104,5 @@ class JsonPathSuite extends CirceSuite {
).asJson
)
)
}

}
5 changes: 2 additions & 3 deletions optics/src/test/scala/io/circe/optics/LawsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ object LawsTests extends Laws {
"modify id = id" -> Prop.forAll((s: S, i: I) => laws(i).modifyIdentity(s)),
"compose modify" -> Prop.forAll((s: S, g: A => A, h: A => A, i: I) => laws(i).composeModify(s, g, h)),
"consistent set with modify" -> Prop.forAll((s: S, a: A, i: I) => laws(i).consistentReplaceModify(s, a)),
"consistent modify with modifyId" -> Prop.forAll((s: S, g: A => A, i: I) =>
laws(i).consistentModifyModifyId(s, g)
),
"consistent modify with modifyId" -> Prop
.forAll((s: S, g: A => A, i: I) => laws(i).consistentModifyModifyId(s, g)),
"consistent getOption with modifyId" -> Prop.forAll((s: S, i: I) => laws(i).consistentGetOptionModifyId(s))
)
}
Expand Down
3 changes: 1 addition & 2 deletions optics/src/test/scala/io/circe/optics/OpticsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ class OpticsSuite extends CirceSuite {
checkAll("jsonObjectIndex", LawsTests.indexTests[JsonObject, String, Json])
checkAll("jsonObjectFilterIndex", LawsTests.filterIndexTests[JsonObject, String, Json])

"jsonDouble" should "round-trip in reverse with Double.NaN" in {
"jsonDouble" should "round-trip in reverse with Double.NaN" in
assert(jsonDouble.getOption(jsonDouble.reverseGet(Double.NaN)) === Some(Double.NaN))
}

it should "partial round-trip with numbers larger than Double.MaxValue" in {
val json = Json.fromJsonNumber(JsonNumber.fromString((BigDecimal(Double.MaxValue) + 1).toString).get)
Expand Down
Loading