diff --git a/quill-jdbc/src/test/scala/io/getquill/context/jdbc/postgres/PeopleJdbcSpec.scala b/quill-jdbc/src/test/scala/io/getquill/context/jdbc/postgres/PeopleJdbcSpec.scala index b57a70b4b7..a14862b6a1 100644 --- a/quill-jdbc/src/test/scala/io/getquill/context/jdbc/postgres/PeopleJdbcSpec.scala +++ b/quill-jdbc/src/test/scala/io/getquill/context/jdbc/postgres/PeopleJdbcSpec.scala @@ -57,4 +57,8 @@ class PeopleJdbcSpec extends PeopleSpec { testContext.run(`Ex 10 page 1 query`) mustEqual `Ex 10 page 1 expected` testContext.run(`Ex 10 page 2 query`) mustEqual `Ex 10 page 2 expected` } + + "Example 11 - contains + isEmpty" in { + testContext.run(`Ex 11 contains`(`Ex 9 param`)) mustEqual `Ex 9 expected result` + } } diff --git a/quill-sql/src/test/scala/io/getquill/context/sql/PeopleSpec.scala b/quill-sql/src/test/scala/io/getquill/context/sql/PeopleSpec.scala index e1bda092cd..4c39c0a9c0 100644 --- a/quill-sql/src/test/scala/io/getquill/context/sql/PeopleSpec.scala +++ b/quill-sql/src/test/scala/io/getquill/context/sql/PeopleSpec.scala @@ -131,6 +131,15 @@ trait PeopleSpec extends Spec { query[Person].filter(p => set.contains(p.age)) } + def `Ex 11 contains`(set: Set[Int]) = quote { + query[Person].filter { p => + if (liftQuery(set).isEmpty) + true + else + liftQuery(set).contains(p.age) + } + } + val `Ex 8 param` = Set.empty[Int] val `Ex 8 expected result` = List.empty[Person]