aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/tests')
-rw-r--r--test-suite/tests/serde.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/test-suite/tests/serde.rs b/test-suite/tests/serde.rs
index 57fa5db..446cd7a 100644
--- a/test-suite/tests/serde.rs
+++ b/test-suite/tests/serde.rs
@@ -569,10 +569,23 @@ fn table_structs_empty() {
expected.insert("bar".to_string(), CanBeEmpty::default());
expected.insert("baz".to_string(), CanBeEmpty::default());
expected.insert(
- "bazv".to_string(),
+ "bazv".to_string(),
CanBeEmpty {a: Some("foo".to_string()), b: None},
);
expected.insert("foo".to_string(), CanBeEmpty::default());
assert_eq!(value, expected);
assert_eq!(toml::to_string(&value).unwrap(), text);
}
+
+#[test]
+fn fixed_size_array() {
+ #[derive(Serialize, PartialEq, Eq, Deserialize, Debug)]
+ struct Entity {
+ pos: [i32; 2]
+ }
+ let text = "pos = [1, 2]\n";
+ let value: Entity = toml::from_str(text).unwrap();
+ let expected = Entity { pos: [1, 2] };
+ assert_eq!(value, expected);
+ assert_eq!(toml::to_string(&value).unwrap(), text);
+}