Skip to content

Commit

Permalink
tests: Cover trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Jun 1, 2024
1 parent 0fc8e7b commit d7cc867
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ testcases! {
}
}

hello_trailingcomma(diag2value) {
DataItem::Array {
data: vec![
DataItem::TextString(TextString {
data: "hello".into(),
bitwidth: IntegerWidth::Unknown,
}),
],
bitwidth: Some(IntegerWidth::Unknown),
},
{
r#"["hello",]"#,
r#"["hello",]"#,
}
}

hello_world(diag2value, value2diag) {
DataItem::Array {
data: vec![
Expand Down
22 changes: 22 additions & 0 deletions tests/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ testcases! {
}
}

hello_world_trailingcomma(diag2value) {
DataItem::Map {
data: vec![
(
DataItem::TextString(TextString {
data: "hello".into(),
bitwidth: IntegerWidth::Unknown,
}),
DataItem::TextString(TextString {
data: "world".into(),
bitwidth: IntegerWidth::Unknown,
}),
),
],
bitwidth: Some(IntegerWidth::Unknown),
},
{
r#"{"hello":"world",}"#,
r#"{"hello": "world",}"#,
}
}

non_alpha(diag2value, value2diag) {
DataItem::Map {
data: vec![
Expand Down

0 comments on commit d7cc867

Please sign in to comment.