-
Notifications
You must be signed in to change notification settings - Fork 144
RUST-1748 Convert serde helpers to serde_with::(De)SerializeAs implementations #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/tests/serde.rs
Outdated
for element in date_vector { | ||
match element { | ||
bson::Bson::String(value) => assert_eq!( | ||
value, iso, | ||
"Expected each element in date_vector to match original.", | ||
), | ||
_ => panic!("Expected all elements in date_vector to be a BSON DateTime."), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be assert_eq!(date_vector, a.date_vector)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to find a cleaner version of using assert_eq
and this is the best I could come up with - it just has less detailed error messages. Do you have any feedback on this before I use it for the other tests?
let date_vector = doc
.get_array("date_vector")
.expect("Expected serialized date_vector to be a BSON array.");
let expected_date_vector: Vec<Bson> = a
.date_vector
.iter()
.map(|dt| Bson::String(dt.try_to_rfc3339_string().unwrap()))
.collect();
assert_eq!(date_vector, &expected_date_vector);
No description provided.