Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Dec 5, 2024
1 parent 0d13632 commit 7eeee32
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class ContextMacroSpec extends Spec {
qr1.filter(t => t.s == lift("a"))
}
testContext.translate(q) mustEqual
"""querySchema("TestEntity").filter(t => t.s == 'a')"""
"""querySchema("TestEntity").filter(t => t.s == lift('a'))"""
}

"value class" in {
Expand All @@ -279,35 +279,35 @@ class ContextMacroSpec extends Spec {
query[Entity].filter(t => t.x == lift(ValueClass(1)))
}
testContext.translate(q) mustEqual
"""querySchema("Entity").filter(t => t.x == 1)"""
"""querySchema("Entity").filter(t => t.x == lift(ValueClass(1)))"""
}
"generic value class" in {
case class Entity(x: GenericValueClass[Int])
val q = quote {
query[Entity].filter(t => t.x == lift(GenericValueClass(1)))
}
testContext.translate(q) mustEqual
"""querySchema("Entity").filter(t => t.x == 1)"""
"""querySchema("Entity").filter(t => t.x == lift(GenericValueClass(1)))"""
}
"sql" in {
val q = quote {
sql"SELECT ${lift("a")}".as[Query[String]]
}
testContext.translate(q) mustEqual s"""sql"SELECT $${'a'}".map(x => x)"""
testContext.translate(q) mustEqual s"""sql"SELECT $${lift('a')}".map(x => x)"""
}
"dynamic" in {
val q = quote {
qr1.filter(t => t.s == lift("a"))
}
testContext.translate(q.dynamic) mustEqual
"""querySchema("TestEntity").filter(t => t.s == 'a')"""
"""querySchema("TestEntity").filter(t => t.s == lift('a'))"""
}
"dynamic type param" in {
def test[T: SchemaMeta: QueryMeta] = quote {
query[T].map(t => lift(1))
}
testContext.translate(test[TestEntity]) mustEqual
"""querySchema("TestEntity").map(t => 1)"""
"""querySchema("TestEntity").map(t => lift(1))"""
}
}
"aggregated" in {
Expand Down

0 comments on commit 7eeee32

Please sign in to comment.