Skip to content

Commit 7796e28

Browse files
authored
Merge pull request #3 from jeremyrsmith/version-1.0.3
Version 1.0.3
2 parents 00ff587 + f64bd03 commit 7796e28

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
## 1.0.3 - 2016-11-29
8+
* Added `equals` implementation for `Patch`
9+
* Added Scala 2.12 support
10+
711
## 1.0.2 - 2016-11-28
812
* Add apply syntax for `Patch`
913

1014
## 1.0.1 - 2016-11-28
1115
* Minor cleanup
1216

1317
## 1.0.0 - 2016-11-27
14-
* Initial release
18+
* Initial release

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ val versions = new {
88
}
99

1010
val commonSettings = Seq(
11-
version := "1.0.2",
11+
version := "1.0.3",
1212
scalaVersion := "2.11.8",
1313
crossScalaVersions := Seq("2.11.8","2.12.1"),
1414
organization := "io.github.jeremyrsmith",

patchless-core/src/main/scala/patchless/Patch.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import scala.language.dynamics
1111
abstract class Patch[T] extends (T => T) {
1212
type Updates <: HList
1313
def updates: Updates
14+
15+
override def equals(obj: scala.Any): Boolean = obj match {
16+
case patch: Patch[_] => patch.updates == updates
17+
case _ => false
18+
}
1419
}
1520

1621
object Patch extends Dynamic {
@@ -53,6 +58,7 @@ object Patch extends Dynamic {
5358
) {
5459
def patchUpdates: U = patch.updates.asInstanceOf[U]
5560
}
61+
5662
}
5763

5864
// Macros to support patch Apply syntax

patchless-core/src/test/scala/patchless/PatchSpec.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,11 @@ class PatchSpec extends FreeSpec with Matchers {
107107

108108
}
109109

110+
"comparison" in {
111+
case class Foo(a: Int, b: String)
112+
Patch[Foo](a = 10) shouldEqual Patch[Foo](a = 10)
113+
Patch[Foo](a = 10) shouldNot equal (Patch[Foo](a = 11))
114+
}
115+
110116

111117
}

0 commit comments

Comments
 (0)