Skip to content

Commit

Permalink
chore: move test for option into own function
Browse files Browse the repository at this point in the history
  • Loading branch information
v3xro committed Aug 5, 2024
1 parent 97b925e commit f515d3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sql/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,17 @@ mod tests {
assert_eq!(check((42, 43)), "(42,43)");
}

#[test]
fn it_writes_options() {
assert_eq!(check(None::<i32>), "NULL");
assert_eq!(check(Some(32)), "32");
assert_eq!(check(Some(vec![42, 43])), "[42,43]");
}

#[test]
fn it_fails_on_unsupported() {
let mut out = String::new();
assert!(write_arg(&mut out, &std::collections::HashMap::<u32, u32>::new()).is_err());
assert!(write_arg(&mut out, &None::<u32>).is_ok());
assert!(write_arg(&mut out, &Some(42)).is_ok());
assert!(write_arg(&mut out, &()).is_err());

#[derive(Serialize)]
Expand Down

0 comments on commit f515d3b

Please sign in to comment.