Skip to content

Commit

Permalink
Merge pull request #3 from jeremyrsmith/version-1.0.3
Browse files Browse the repository at this point in the history
Version 1.0.3
  • Loading branch information
jeremyrsmith authored Jan 9, 2017
2 parents 00ff587 + f64bd03 commit 7796e28
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## 1.0.3 - 2016-11-29
* Added `equals` implementation for `Patch`
* Added Scala 2.12 support

## 1.0.2 - 2016-11-28
* Add apply syntax for `Patch`

## 1.0.1 - 2016-11-28
* Minor cleanup

## 1.0.0 - 2016-11-27
* Initial release
* Initial release
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val versions = new {
}

val commonSettings = Seq(
version := "1.0.2",
version := "1.0.3",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8","2.12.1"),
organization := "io.github.jeremyrsmith",
Expand Down
6 changes: 6 additions & 0 deletions patchless-core/src/main/scala/patchless/Patch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import scala.language.dynamics
abstract class Patch[T] extends (T => T) {
type Updates <: HList
def updates: Updates

override def equals(obj: scala.Any): Boolean = obj match {
case patch: Patch[_] => patch.updates == updates
case _ => false
}
}

object Patch extends Dynamic {
Expand Down Expand Up @@ -53,6 +58,7 @@ object Patch extends Dynamic {
) {
def patchUpdates: U = patch.updates.asInstanceOf[U]
}

}

// Macros to support patch Apply syntax
Expand Down
6 changes: 6 additions & 0 deletions patchless-core/src/test/scala/patchless/PatchSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,11 @@ class PatchSpec extends FreeSpec with Matchers {

}

"comparison" in {
case class Foo(a: Int, b: String)
Patch[Foo](a = 10) shouldEqual Patch[Foo](a = 10)
Patch[Foo](a = 10) shouldNot equal (Patch[Foo](a = 11))
}


}

0 comments on commit 7796e28

Please sign in to comment.