Skip to content

Commit 14dfae2

Browse files
Add simple test
1 parent 7560858 commit 14dfae2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/postgres/macros.rs

+17
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ async fn test_query() -> anyhow::Result<()> {
2121
Ok(())
2222
}
2323

24+
#[sqlx_macros::test]
25+
async fn test_query_tuple() -> anyhow::Result<()> {
26+
let mut conn = new::<Postgres>().await?;
27+
28+
let account = sqlx::query_tuple!(
29+
"SELECT * from (VALUES (1, 'Herp Derpinson')) accounts(id, name) where id = $1",
30+
1i32
31+
)
32+
.fetch_one(&mut conn)
33+
.await?;
34+
35+
assert_eq!(account.0, Some(1));
36+
assert_eq!(account.1.as_deref(), Some("Herp Derpinson"));
37+
38+
Ok(())
39+
}
40+
2441
#[sqlx_macros::test]
2542
async fn test_non_null() -> anyhow::Result<()> {
2643
let mut conn = new::<Postgres>().await?;

0 commit comments

Comments
 (0)