Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit f5f5087

Browse files
committed
Release 0.5.0
1 parent 64e1eca commit f5f5087

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

README.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![diffx](https://github.com/softwaremill/diffx/raw/master/banner.png)
22

3-
[![CI](https://github.com/softwaremill/diffx/workflows/CI/badge.svg)](https://github.com/softwaremill/diffx/actions?query=workflow%3A%22CI%22)
3+
[![Build Status](https://travis-ci.org/softwaremill/diffx.svg?branch=master)](https://travis-ci.org/softwaremill/diffx)
44
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.softwaremill.diffx/diffx-core_2.13/badge.svg)](https://search.maven.org/search?q=g:com.softwaremill.diffx)
55
[![Gitter](https://badges.gitter.im/softwaremill/diffx.svg)](https://gitter.im/softwaremill/diffx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
66
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/softwaremill/diffx&style=flat)](https://mergify.io)
@@ -38,7 +38,7 @@ The library is published for Scala 2.12 and 2.13.
3838
Add the following dependency:
3939

4040
```scala
41-
"com.softwaremill.diffx" %% "diffx-core" % "0.4.5"
41+
"com.softwaremill.diffx" %% "diffx-core" % "0.5.0"
4242
```
4343

4444
```scala
@@ -51,34 +51,53 @@ val right: Foo = Foo(
5151
List(123, 1234),
5252
Some(Bar("asdf", 5))
5353
)
54-
// right: Foo = Foo(Bar("asdf", 5), List(123, 1234), Some(Bar("asdf", 5)))
54+
// right: Foo = Foo(
55+
// bar = Bar(s = "asdf", i = 5),
56+
// b = List(123, 1234),
57+
// parent = Some(value = Bar(s = "asdf", i = 5))
58+
// )
5559

5660
val left: Foo = Foo(
5761
Bar("asdf", 66),
5862
List(1234),
5963
Some(right)
6064
)
6165
// left: Foo = Foo(
62-
// Bar("asdf", 66),
63-
// List(1234),
64-
// Some(Foo(Bar("asdf", 5), List(123, 1234), Some(Bar("asdf", 5))))
66+
// bar = Bar(s = "asdf", i = 66),
67+
// b = List(1234),
68+
// parent = Some(
69+
// value = Foo(
70+
// bar = Bar(s = "asdf", i = 5),
71+
// b = List(123, 1234),
72+
// parent = Some(value = Bar(s = "asdf", i = 5))
73+
// )
74+
// )
6575
// )
6676

6777
import com.softwaremill.diffx.generic.auto._
6878
import com.softwaremill.diffx._
6979
compare(left, right)
7080
// res0: DiffResult = DiffResultObject(
71-
// "Foo",
72-
// ListMap(
81+
// name = "Foo",
82+
// fields = ListMap(
7383
// "bar" -> DiffResultObject(
74-
// "Bar",
75-
// ListMap("s" -> Identical("asdf"), "i" -> DiffResultValue(66, 5))
84+
// name = "Bar",
85+
// fields = ListMap(
86+
// "s" -> Identical(value = "asdf"),
87+
// "i" -> DiffResultValue(left = 66, right = 5)
88+
// )
7689
// ),
7790
// "b" -> DiffResultObject(
78-
// "List",
79-
// ListMap("0" -> DiffResultValue(1234, 123), "1" -> DiffResultMissing(1234))
91+
// name = "List",
92+
// fields = ListMap(
93+
// "0" -> DiffResultValue(left = 1234, right = 123),
94+
// "1" -> DiffResultMissing(value = 1234)
95+
// )
8096
// ),
81-
// "parent" -> DiffResultValue("repl.MdocSession.App.Foo", "repl.MdocSession.App.Bar")
97+
// "parent" -> DiffResultValue(
98+
// left = "repl.MdocSession.App.Foo",
99+
// right = "repl.MdocSession.App.Bar"
100+
// )
82101
// )
83102
// )
84103
```
@@ -131,7 +150,7 @@ If anyone has an idea how this could be improved, I am open for suggestions.
131150
To use with scalatest, add the following dependency:
132151

133152
```scala
134-
"com.softwaremill.diffx" %% "diffx-scalatest" % "0.4.5" % Test
153+
"com.softwaremill.diffx" %% "diffx-scalatest" % "0.5.0" % Test
135154
```
136155

137156
Then, extend the `com.softwaremill.diffx.scalatest.DiffMatcher` trait or `import com.softwaremill.diffx.scalatest.DiffMatcher._`.
@@ -151,7 +170,7 @@ Giving you nice error messages:
151170
To use with specs2, add the following dependency:
152171

153172
```scala
154-
"com.softwaremill.diffx" %% "diffx-specs2" % "0.4.5" % Test
173+
"com.softwaremill.diffx" %% "diffx-specs2" % "0.5.0" % Test
155174
```
156175

157176
Then, extend the `com.softwaremill.diffx.specs2.DiffMatcher` trait or `import com.softwaremill.diffx.specs2.DiffMatcher._`.
@@ -169,7 +188,7 @@ left must matchTo(right)
169188
To use with utest, add following dependency:
170189

171190
```scala
172-
"com.softwaremill.diffx" %% "diffx-utest" % "0.4.5" % Test
191+
"com.softwaremill.diffx" %% "diffx-utest" % "0.5.0" % Test
173192
```
174193

175194
Then, mixin `DiffxAssertions` trait or add `import com.softwaremill.diffx.utest.DiffxAssertions._` to your test code.
@@ -191,7 +210,7 @@ instance of the `Diff` typeclass into the implicit scope. The whole process look
191210

192211
```scala
193212
case class Person(name:String, age:Int)
194-
implicit val modifiedDiff: Diff[Person] = Derived[Diff[Person]].ignore[Person,String](_.name)
213+
implicit val modifiedDiff: Diff[Person] = Derived[Diff[Person]].ignore(_.name)
195214
```
196215

197216
## Customization
@@ -220,16 +239,16 @@ sealed trait ABParent
220239
case class A(id: String, name: String) extends ABParent
221240
case class B(id: String, name: String) extends ABParent
222241

223-
implicit val diffA: Diff[A] = Derived[Diff[A]].ignore[A, String](_.id)
242+
implicit val diffA: Diff[A] = Derived[Diff[A]].ignore(_.id)
224243
```
225244
```scala
226245
val a1: ABParent = A("1", "X")
227-
// a1: ABParent = A("1", "X")
246+
// a1: ABParent = A(id = "1", name = "X")
228247
val a2: ABParent = A("2", "X")
229-
// a2: ABParent = A("2", "X")
248+
// a2: ABParent = A(id = "2", name = "X")
230249

231250
compare(a1, a2)
232-
// res6: DiffResult = Identical(A("1", "X"))
251+
// res6: DiffResult = Identical(value = A(id = "1", name = "X"))
233252
```
234253

235254
As you can see instead of summoning bare instance of `Diff` for given `A` we summoned `Derived[Diff[A]]`.
@@ -245,17 +264,17 @@ with the compiler option `"-P:silencer:globalFilters=^magnolia: using fallback d
245264

246265
- [com.softwaremill.common.tagging](https://github.com/softwaremill/scala-common)
247266
```scala
248-
"com.softwaremill.diffx" %% "diffx-tagging" % "0.4.5"
267+
"com.softwaremill.diffx" %% "diffx-tagging" % "0.5.0"
249268
```
250269
`com.softwaremill.diffx.tagging.DiffTaggingSupport`
251270
- [eu.timepit.refined](https://github.com/fthomas/refined)
252271
```scala
253-
"com.softwaremill.diffx" %% "diffx-refined" % "0.4.5"
272+
"com.softwaremill.diffx" %% "diffx-refined" % "0.5.0"
254273
```
255274
`com.softwaremill.diffx.refined.RefinedSupport`
256275
- [org.typelevel.cats](https://github.com/typelevel/cats)
257276
```scala
258-
"com.softwaremill.diffx" %% "diffx-cats" % "0.4.5"
277+
"com.softwaremill.diffx" %% "diffx-cats" % "0.5.0"
259278
```
260279
`com.softwaremill.diffx.cats.DiffCatsInstances`
261280

0 commit comments

Comments
 (0)