Skip to content

Commit

Permalink
Add test for issue typelevel#2144 with fixed formating
Browse files Browse the repository at this point in the history
  • Loading branch information
david-lebl-adastra committed Jan 29, 2025
1 parent 314742a commit beba12d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions modules/core/src/test/scala/doobie/util/ReadSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,20 @@ class ReadSuite extends munit.FunSuite with ReadSuitePlatform {
_ <- sql"insert into foo values (1, 'a'), (2, 'b'), (3, 'c')".update.run
_ <- sql"insert into bar values (1, 1, 'c'), (2, 2, null)".update.run

q <- sql"select f.foo_key, f.foo_value, b.bar_key, b.bar_value from foo f left join bar b on f.foo_key = b.foo_key".query[(Foo, Option[Bar])].to[List]
q <-
sql"select f.foo_key, f.foo_value, b.bar_key, b.bar_value from foo f left join bar b on f.foo_key = b.foo_key"
.query[(Foo, Option[Bar])].to[List]
} yield q)
.transact(xa)
.unsafeRunSync()

assertEquals(result, List(
(Foo(1, "a"), Some(Bar(1, Some("c")))),
(Foo(2, "b"), Some(Bar(2, None))),
(Foo(3, "c"), None)
))
assertEquals(
result,
List(
(Foo(1, "a"), Some(Bar(1, Some("c")))),
(Foo(2, "b"), Some(Bar(2, None))),
(Foo(3, "c"), None)
))
}

test("Read should read correct columns for instances with Option (Some)") {
Expand Down

0 comments on commit beba12d

Please sign in to comment.