Skip to content

Commit e2d3050

Browse files
committed
Remove vec workaround in tests
1 parent 1fcf026 commit e2d3050

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

tokio-postgres/tests/test/types/bit_vec_07.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async fn test_bit_params() {
99
bv.pop();
1010
test_type(
1111
"BIT(14)",
12-
vec![(Some(bv), "B'01101001000001'"), (None, "NULL")],
12+
&[(Some(bv), "B'01101001000001'"), (None, "NULL")],
1313
)
1414
.await
1515
}
@@ -21,7 +21,7 @@ async fn test_varbit_params() {
2121
bv.pop();
2222
test_type(
2323
"VARBIT",
24-
vec![
24+
&[
2525
(Some(bv), "B'01101001000001'"),
2626
(Some(BitVec::from_bytes(&[])), "B''"),
2727
(None, "NULL"),

tokio-postgres/tests/test/types/chrono_04.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async fn test_naive_date_time_params() {
1313
}
1414
test_type(
1515
"TIMESTAMP",
16-
vec![
16+
&[
1717
make_check("'1970-01-01 00:00:00.010000000'"),
1818
make_check("'1965-09-25 11:19:33.100314000'"),
1919
make_check("'2010-02-09 23:11:45.120200000'"),
@@ -35,7 +35,7 @@ async fn test_with_special_naive_date_time_params() {
3535
}
3636
test_type(
3737
"TIMESTAMP",
38-
vec![
38+
&[
3939
make_check("'1970-01-01 00:00:00.010000000'"),
4040
make_check("'1965-09-25 11:19:33.100314000'"),
4141
make_check("'2010-02-09 23:11:45.120200000'"),
@@ -59,7 +59,7 @@ async fn test_date_time_params() {
5959
}
6060
test_type(
6161
"TIMESTAMP WITH TIME ZONE",
62-
vec![
62+
&[
6363
make_check("'1970-01-01 00:00:00.010000000'"),
6464
make_check("'1965-09-25 11:19:33.100314000'"),
6565
make_check("'2010-02-09 23:11:45.120200000'"),
@@ -82,7 +82,7 @@ async fn test_with_special_date_time_params() {
8282
}
8383
test_type(
8484
"TIMESTAMP WITH TIME ZONE",
85-
vec![
85+
&[
8686
make_check("'1970-01-01 00:00:00.010000000'"),
8787
make_check("'1965-09-25 11:19:33.100314000'"),
8888
make_check("'2010-02-09 23:11:45.120200000'"),
@@ -103,7 +103,7 @@ async fn test_date_params() {
103103
}
104104
test_type(
105105
"DATE",
106-
vec![
106+
&[
107107
make_check("'1970-01-01'"),
108108
make_check("'1965-09-25'"),
109109
make_check("'2010-02-09'"),
@@ -123,7 +123,7 @@ async fn test_with_special_date_params() {
123123
}
124124
test_type(
125125
"DATE",
126-
vec![
126+
&[
127127
make_check("'1970-01-01'"),
128128
make_check("'1965-09-25'"),
129129
make_check("'2010-02-09'"),
@@ -144,7 +144,7 @@ async fn test_time_params() {
144144
}
145145
test_type(
146146
"TIME",
147-
vec![
147+
&[
148148
make_check("'00:00:00.010000000'"),
149149
make_check("'11:19:33.100314000'"),
150150
make_check("'23:11:45.120200000'"),

tokio-postgres/tests/test/types/eui48_04.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::types::test_type;
66
async fn test_eui48_params() {
77
test_type(
88
"MACADDR",
9-
vec![
9+
&[
1010
(
1111
Some(MacAddress::parse_str("12-34-56-AB-CD-EF").unwrap()),
1212
"'12-34-56-ab-cd-ef'",

tokio-postgres/tests/test/types/geo_010.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::types::test_type;
66
async fn test_point_params() {
77
test_type(
88
"POINT",
9-
vec![
9+
&[
1010
(Some(Point::new(0.0, 0.0)), "POINT(0, 0)"),
1111
(Some(Point::new(-3.14, 1.618)), "POINT(-3.14, 1.618)"),
1212
(None, "NULL"),
@@ -19,7 +19,7 @@ async fn test_point_params() {
1919
async fn test_box_params() {
2020
test_type(
2121
"BOX",
22-
vec![
22+
&[
2323
(
2424
Some(Rect {
2525
min: Coordinate { x: -3.14, y: 1.618 },
@@ -48,7 +48,7 @@ async fn test_path_params() {
4848
];
4949
test_type(
5050
"PATH",
51-
vec![
51+
&[
5252
(
5353
Some(LineString(points)),
5454
"path '((0, 0), (-3.14, 1.618), (160.0, 69701.5615))'",

tokio-postgres/tests/test/types/mod.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod serde_json_1;
2525
#[cfg(feature = "with-uuid-0_7")]
2626
mod 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)])
2929
where
3030
T: PartialEq + for<'a> FromSqlOwned + ToSql,
3131
S: fmt::Display,
@@ -43,7 +43,7 @@ where
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]
6363
async 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]
7272
async 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]
7777
async 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() {
9393
async 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() {
106106
async 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() {
119119
async 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() {
132132
async 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() {
145145
async 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() {
159159
async 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() {
173173
async 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() {
189189
async 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() {
296296
async 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 {
329329
async 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() {
350350
async 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_() {
607607
async 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() {
630630
async 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()),

tokio-postgres/tests/test/types/serde_json_1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::types::test_type;
66
async fn test_json_params() {
77
test_type(
88
"JSON",
9-
vec![
9+
&[
1010
(
1111
Some(serde_json_1::from_str::<Value>("[10, 11, 12]").unwrap()),
1212
"'[10, 11, 12]'",
@@ -25,7 +25,7 @@ async fn test_json_params() {
2525
async fn test_jsonb_params() {
2626
test_type(
2727
"JSONB",
28-
vec![
28+
&[
2929
(
3030
Some(serde_json_1::from_str::<Value>("[10, 11, 12]").unwrap()),
3131
"'[10, 11, 12]'",

tokio-postgres/tests/test/types/uuid_07.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::types::test_type;
66
async fn test_uuid_params() {
77
test_type(
88
"UUID",
9-
vec![
9+
&[
1010
(
1111
Some(Uuid::parse_str("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11").unwrap()),
1212
"'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'",

0 commit comments

Comments
 (0)