Skip to content

Commit a67f4a1

Browse files
committed
fix(odbc): reorganize UUID tests and include additional decoding cases
1 parent 2807288 commit a67f4a1

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

tests/odbc/types.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(clippy::approx_constant)]
22
use sqlx_oldapi::odbc::Odbc;
3-
use sqlx_test::{test_decode_type, test_type};
3+
use sqlx_test::test_type;
44

55
// Basic null test
66
test_type!(null<Option<i32>>(Odbc,
@@ -98,16 +98,19 @@ test_type!(string<String>(Odbc,
9898

9999
// Feature-gated types
100100
#[cfg(feature = "uuid")]
101-
test_type!(uuid<sqlx_oldapi::types::Uuid>(Odbc,
101+
mod uuid_tests {
102+
use super::*;
103+
use sqlx_test::test_decode_type;
104+
105+
test_type!(uuid<sqlx_oldapi::types::Uuid>(Odbc,
102106
"'550e8400-e29b-41d4-a716-446655440000'" == sqlx_oldapi::types::Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000").unwrap(),
103-
"'00000000-0000-0000-0000-000000000000'" == sqlx_oldapi::types::Uuid::nil()
104-
));
107+
"'00000000-0000-0000-0000-000000000000'" == sqlx_oldapi::types::Uuid::nil()
108+
));
105109

106-
// Extra UUID decoding edge cases (ODBC may return padded strings)
107-
#[cfg(feature = "uuid")]
108-
test_decode_type!(uuid_padded<sqlx_oldapi::types::Uuid>(Odbc,
109-
"'550e8400-e29b-41d4-a716-446655440000 '" == sqlx_oldapi::types::Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000").unwrap()
110-
));
110+
test_decode_type!(uuid_padded<sqlx_oldapi::types::Uuid>(Odbc,
111+
"'550e8400-e29b-41d4-a716-446655440000 '" == sqlx_oldapi::types::Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000").unwrap()
112+
));
113+
}
111114

112115
#[cfg(feature = "json")]
113116
mod json_tests {
@@ -144,6 +147,7 @@ mod chrono_tests {
144147
use sqlx_oldapi::types::chrono::{
145148
DateTime, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime, Utc,
146149
};
150+
use sqlx_test::test_decode_type;
147151

148152
test_type!(chrono_date<NaiveDate>(Odbc,
149153
"'2023-12-25'" == NaiveDate::from_ymd_opt(2023, 12, 25).unwrap(),

0 commit comments

Comments
 (0)