@@ -25,7 +25,7 @@ mod serde_json_1;
2525#[ cfg( feature = "with-uuid-0_7" ) ]
2626mod uuid_07;
2727
28- async fn test_type < T , S > ( sql_type : & str , checks : Vec < ( T , S ) > )
28+ async fn test_type < T , S > ( sql_type : & str , checks : & [ ( T , S ) ] )
2929where
3030 T : PartialEq + for < ' a > FromSqlOwned + ToSql ,
3131 S : fmt:: Display ,
4343 . await
4444 . unwrap ( ) ;
4545 let result = rows[ 0 ] . get ( 0 ) ;
46- assert_eq ! ( val, result) ;
46+ assert_eq ! ( val, & result) ;
4747
4848 let stmt = client
4949 . prepare ( & format ! ( "SELECT $1::{}" , sql_type) )
@@ -55,29 +55,29 @@ where
5555 . await
5656 . unwrap ( ) ;
5757 let result = rows[ 0 ] . get ( 0 ) ;
58- assert_eq ! ( val, result) ;
58+ assert_eq ! ( val, & result) ;
5959 }
6060}
6161
6262#[ tokio:: test]
6363async fn test_bool_params ( ) {
6464 test_type (
6565 "BOOL" ,
66- vec ! [ ( Some ( true ) , "'t'" ) , ( Some ( false ) , "'f'" ) , ( None , "NULL" ) ] ,
66+ & [ ( Some ( true ) , "'t'" ) , ( Some ( false ) , "'f'" ) , ( None , "NULL" ) ] ,
6767 )
6868 . await ;
6969}
7070
7171#[ tokio:: test]
7272async fn test_i8_params ( ) {
73- test_type ( "\" char\" " , vec ! [ ( Some ( 'a' as i8 ) , "'a'" ) , ( None , "NULL" ) ] ) . await ;
73+ test_type ( "\" char\" " , & [ ( Some ( 'a' as i8 ) , "'a'" ) , ( None , "NULL" ) ] ) . await ;
7474}
7575
7676#[ tokio:: test]
7777async fn test_name_params ( ) {
7878 test_type (
7979 "NAME" ,
80- vec ! [
80+ & [
8181 ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
8282 (
8383 Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) ,
@@ -93,7 +93,7 @@ async fn test_name_params() {
9393async fn test_i16_params ( ) {
9494 test_type (
9595 "SMALLINT" ,
96- vec ! [
96+ & [
9797 ( Some ( 15001i16 ) , "15001" ) ,
9898 ( Some ( -15001i16 ) , "-15001" ) ,
9999 ( None , "NULL" ) ,
@@ -106,7 +106,7 @@ async fn test_i16_params() {
106106async fn test_i32_params ( ) {
107107 test_type (
108108 "INT" ,
109- vec ! [
109+ & [
110110 ( Some ( 2_147_483_548i32 ) , "2147483548" ) ,
111111 ( Some ( -2_147_483_548i32 ) , "-2147483548" ) ,
112112 ( None , "NULL" ) ,
@@ -119,7 +119,7 @@ async fn test_i32_params() {
119119async fn test_oid_params ( ) {
120120 test_type (
121121 "OID" ,
122- vec ! [
122+ & [
123123 ( Some ( 2_147_483_548u32 ) , "2147483548" ) ,
124124 ( Some ( 4_000_000_000 ) , "4000000000" ) ,
125125 ( None , "NULL" ) ,
@@ -132,7 +132,7 @@ async fn test_oid_params() {
132132async fn test_i64_params ( ) {
133133 test_type (
134134 "BIGINT" ,
135- vec ! [
135+ & [
136136 ( Some ( 9_223_372_036_854_775_708i64 ) , "9223372036854775708" ) ,
137137 ( Some ( -9_223_372_036_854_775_708i64 ) , "-9223372036854775708" ) ,
138138 ( None , "NULL" ) ,
@@ -145,7 +145,7 @@ async fn test_i64_params() {
145145async fn test_f32_params ( ) {
146146 test_type (
147147 "REAL" ,
148- vec ! [
148+ & [
149149 ( Some ( f32:: INFINITY ) , "'infinity'" ) ,
150150 ( Some ( f32:: NEG_INFINITY ) , "'-infinity'" ) ,
151151 ( Some ( 1000.55 ) , "1000.55" ) ,
@@ -159,7 +159,7 @@ async fn test_f32_params() {
159159async fn test_f64_params ( ) {
160160 test_type (
161161 "DOUBLE PRECISION" ,
162- vec ! [
162+ & [
163163 ( Some ( f64:: INFINITY ) , "'infinity'" ) ,
164164 ( Some ( f64:: NEG_INFINITY ) , "'-infinity'" ) ,
165165 ( Some ( 10000.55 ) , "10000.55" ) ,
@@ -173,7 +173,7 @@ async fn test_f64_params() {
173173async fn test_varchar_params ( ) {
174174 test_type (
175175 "VARCHAR" ,
176- vec ! [
176+ & [
177177 ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
178178 (
179179 Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) ,
@@ -189,7 +189,7 @@ async fn test_varchar_params() {
189189async fn test_text_params ( ) {
190190 test_type (
191191 "TEXT" ,
192- vec ! [
192+ & [
193193 ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
194194 (
195195 Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) ,
@@ -296,7 +296,7 @@ async fn test_citext_params() {
296296async fn test_bytea_params ( ) {
297297 test_type (
298298 "BYTEA" ,
299- vec ! [
299+ & [
300300 ( Some ( vec ! [ 0u8 , 1 , 2 , 3 , 254 , 255 ] ) , "'\\ x00010203feff'" ) ,
301301 ( None , "NULL" ) ,
302302 ] ,
@@ -329,7 +329,7 @@ macro_rules! make_map {
329329async fn test_hstore_params ( ) {
330330 test_type (
331331 "hstore" ,
332- vec ! [
332+ & [
333333 (
334334 Some ( make_map ! ( "a" . to_owned( ) => Some ( "1" . to_owned( ) ) ) ) ,
335335 "'a=>1'" ,
@@ -350,7 +350,7 @@ async fn test_hstore_params() {
350350async fn test_array_params ( ) {
351351 test_type (
352352 "integer[]" ,
353- vec ! [
353+ & [
354354 ( Some ( vec ! [ 1i32 , 2i32 ] ) , "ARRAY[1,2]" ) ,
355355 ( Some ( vec ! [ 1i32 ] ) , "ARRAY[1]" ) ,
356356 ( Some ( vec ! [ ] ) , "ARRAY[]" ) ,
@@ -607,7 +607,7 @@ async fn enum_() {
607607async fn system_time ( ) {
608608 test_type (
609609 "TIMESTAMP" ,
610- vec ! [
610+ & [
611611 (
612612 Some ( UNIX_EPOCH + Duration :: from_millis ( 1_010 ) ) ,
613613 "'1970-01-01 00:00:01.01'" ,
@@ -630,7 +630,7 @@ async fn system_time() {
630630async fn inet ( ) {
631631 test_type (
632632 "INET" ,
633- vec ! [
633+ & [
634634 ( Some ( "127.0.0.1" . parse :: < IpAddr > ( ) . unwrap ( ) ) , "'127.0.0.1'" ) ,
635635 (
636636 Some ( "127.0.0.1" . parse :: < IpAddr > ( ) . unwrap ( ) ) ,
0 commit comments