Skip to content

Commit

Permalink
test(serde): Show skipping behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 8, 2023
1 parent ff85919 commit 4238c46
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crates/toml/tests/testsuite/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,25 @@ fn datetime_offset_issue_496() {
let output = toml.to_string();
snapbox::assert_eq(original, output);
}

#[test]
fn serialize_array_with_none_value() {
#[derive(Serialize)]
struct Document {
values: Vec<Option<usize>>,
}

let input = Document {
values: vec![Some(1), Some(2), Some(3)],
};
let expected = "values = [1, 2, 3]\n";
let raw = toml::to_string(&input).unwrap();
snapbox::assert_eq(expected, raw);

let input = Document {
values: vec![Some(1), None, Some(3)],
};
let expected = "";
let raw = toml::to_string(&input).unwrap();
snapbox::assert_eq(expected, raw);
}

0 comments on commit 4238c46

Please sign in to comment.