From 045b57adeb02bd2fe45b63b74df490c20a1f8536 Mon Sep 17 00:00:00 2001 From: lantz moore Date: Wed, 13 Feb 2019 17:43:59 -0800 Subject: [PATCH] * add a failing test for eachWhere vs closure --- .../com/softwaremill/quicklens/ModifyEachWhereTest.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/src/test/scala/com/softwaremill/quicklens/ModifyEachWhereTest.scala b/tests/src/test/scala/com/softwaremill/quicklens/ModifyEachWhereTest.scala index d7d3e54..85a8d1e 100644 --- a/tests/src/test/scala/com/softwaremill/quicklens/ModifyEachWhereTest.scala +++ b/tests/src/test/scala/com/softwaremill/quicklens/ModifyEachWhereTest.scala @@ -14,6 +14,13 @@ class ModifyEachWhereTest extends FlatSpec with Matchers { x4.modify(_.x5.eachWhere(_ => false).name).using(duplicate) should be(x4) } + it should "modify be able to eachWhere a lambda" in { + val foo = true + x4.modify(_.x5.eachWhere(_ => foo).name).using(duplicate) should be(x4dup) + val bar = false + x4.modify(_.x5.eachWhere(_ => bar).name).using(duplicate) should be(x4) + } + it should "not modify an optional case class field if it is none regardless of the condition" in { modify(x4none)(_.x5.eachWhere(_ => true).name).using(duplicate) should be( x4none)