Skip to content

Commit

Permalink
Merge pull request #190 from sval-rs/chore/json-unit-struct-test
Browse files Browse the repository at this point in the history
Add a test case for unit structs
  • Loading branch information
KodrAus authored Jan 31, 2024
2 parents e6c55d3 + 775b605 commit 8e77f72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions json/test/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct EmptyMap {}
#[derive(Value, Serialize)]
struct Tagged<T>(T);

#[derive(Value, Serialize)]
struct UnitStruct;

#[derive(Clone, Value, Serialize)]
enum Enum<F0, F1> {
Constant,
Expand Down Expand Up @@ -154,6 +157,13 @@ fn stream_unit() {
assert_json(());
}

#[test]
fn stream_unit_struct() {
// NOTE: This is an incompatibility with `serde_json`
// In `serde_json` this would produce `null`
assert_stream("\"UnitStruct\"", UnitStruct);
}

#[test]
fn stream_map_struct() {
assert_json(MapStruct {
Expand Down

0 comments on commit 8e77f72

Please sign in to comment.