Skip to content

Commit b4bc68f

Browse files
committed
test(format): Verify null where supported
Can't add json5 to this yet becaue its broken
1 parent 35bafb9 commit b4bc68f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

tests/testsuite/file_json.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn test_file() {
1616
place: Place,
1717
#[serde(rename = "arr")]
1818
elements: Vec<String>,
19+
nullable: Option<String>,
1920
}
2021

2122
#[derive(Debug, Deserialize)]
@@ -52,7 +53,8 @@ fn test_file() {
5253
}
5354
},
5455
"FOO": "FOO should be overridden",
55-
"bar": "I am bar"
56+
"bar": "I am bar",
57+
"nullable": null
5658
}
5759
"#,
5860
FileFormat::Json,
@@ -92,6 +94,7 @@ fn test_file() {
9294
"John Smith".to_owned()
9395
);
9496
}
97+
assert_eq!(s.nullable, None);
9598
}
9699

97100
#[test]

tests/testsuite/file_ron.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn test_file() {
1616
place: Place,
1717
#[serde(rename = "arr")]
1818
elements: Vec<String>,
19+
nullable: Option<String>,
1920
}
2021

2122
#[derive(Debug, Deserialize)]
@@ -54,7 +55,8 @@ fn test_file() {
5455
}
5556
),
5657
FOO: "FOO should be overridden",
57-
bar: "I am bar"
58+
bar: "I am bar",
59+
nullable: None
5860
)
5961
"#,
6062
FileFormat::Ron,
@@ -95,6 +97,7 @@ fn test_file() {
9597
"John Smith".to_owned()
9698
);
9799
}
100+
assert_eq!(s.nullable, None);
98101
}
99102

100103
#[test]

tests/testsuite/file_yaml.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fn test_file() {
1818
place: Place,
1919
#[serde(rename = "arr")]
2020
elements: Vec<String>,
21+
nullable: Option<String>,
2122
}
2223

2324
#[derive(Debug, Deserialize)]
@@ -52,6 +53,7 @@ place:
5253
# For override tests
5354
FOO: FOO should be overridden
5455
bar: I am bar
56+
nullable: null
5557
"#,
5658
FileFormat::Yaml,
5759
))
@@ -90,6 +92,7 @@ bar: I am bar
9092
"John Smith".to_owned()
9193
);
9294
}
95+
assert_eq!(s.nullable, None);
9396
}
9497

9598
#[test]

0 commit comments

Comments
 (0)