This repository was archived by the owner on Jan 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
main/scala/com/softwaremill/diffx
test/scala/com/softwaremill/diffx/test Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ object Tree {
67
67
def empty [T ]: Node [T ] = Tree .Node [T ](Map .empty)
68
68
69
69
case class Leaf [T ](v : T ) extends Tree [T ] {
70
- override def merge (tree : Tree [T ]): Tree [T ] = this
70
+ override def merge (tree : Tree [T ]): Tree [T ] = tree
71
71
}
72
72
case class Node [T ](tries : Map [ModifyPath , Tree [T ]]) extends Tree [T ] {
73
73
override def merge (tree : Tree [T ]): Tree [T ] = {
Original file line number Diff line number Diff line change @@ -320,4 +320,31 @@ class DiffModifyIntegrationTest extends AnyFlatSpec with Matchers with AutoDeriv
320
320
)
321
321
)
322
322
}
323
+
324
+ it should " allow propagate modification from substituted diff instance" in {
325
+ case class Address (house : Int , street : String )
326
+ case class Person (name : String , address : Address )
327
+
328
+ val add = Diff .summon[Address ].ignore(_.house)
329
+ val d = Diff
330
+ .summon[Person ]
331
+ .modify(_.address)
332
+ .setTo(add)
333
+
334
+ val a1 = Address (123 , " Robin St." )
335
+ val a2 = Address (456 , " Robin St." )
336
+
337
+ val p1 = Person (" Mason" , a1)
338
+ val p2 = Person (" Mason" , a2)
339
+ d(p1, p2) shouldBe DiffResultObject (
340
+ " Person" ,
341
+ ListMap (
342
+ " name" -> IdenticalValue (" Mason" ),
343
+ " address" -> DiffResultObject (
344
+ " Address" ,
345
+ ListMap (" house" -> IdenticalValue (" <ignored>" ), " street" -> IdenticalValue (" Robin St." ))
346
+ )
347
+ )
348
+ )
349
+ }
323
350
}
You can’t perform that action at this time.
0 commit comments