From c59d7aeebe0df24c16b17915ba84635e7241e090 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Sun, 29 Mar 2020 01:33:12 -0700 Subject: [PATCH] macro tests: update for null inferrence --- tests/postgres-types.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/postgres-types.rs b/tests/postgres-types.rs index 70f19ee4..c3b4d6bf 100644 --- a/tests/postgres-types.rs +++ b/tests/postgres-types.rs @@ -21,8 +21,11 @@ macro_rules! array_macro_test { $( let v: &[$type] = $value; let res = sqlx::query!($sql, v).fetch_one(&mut conn).await?; - assert_eq!(res.value, v); - assert_eq!(res.out, v); + + // these must be unwrapped in query! because postgres infers expressions + // to be potentially NULL at all times even if it's impossible to be NULL + assert_eq!(res.value.unwrap(), v); + assert_eq!(res.out.unwrap(), v); )+ Ok(()) @@ -701,7 +704,7 @@ mod json { .fetch_one(&mut conn) .await?; - assert_eq!(v, res._1); + assert_eq!(Some(v), res._1); assert_eq!(res._1, res._2); Ok(())