diff options
author | Alex Crichton <alex@alexcrichton.com> | 2018-05-24 10:22:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 10:22:11 -0500 |
commit | 2be7ce9079fa02d9dd42958410ba1c40cef9811c (patch) | |
tree | f3532b3553bfaa7c307f927d899fa5cb8c2037c1 /test-suite/tests | |
parent | eddcac68781e43905b1e00f1b687bfa1134c2327 (diff) | |
parent | b192b562b49e0de2ff9cbc20a3dd995ad615f78d (diff) | |
download | milf-rs-2be7ce9079fa02d9dd42958410ba1c40cef9811c.tar.gz milf-rs-2be7ce9079fa02d9dd42958410ba1c40cef9811c.zip |
Merge pull request #245 from alexcrichton/tuples
Support fixed-length arrays
Diffstat (limited to 'test-suite/tests')
-rw-r--r-- | test-suite/tests/serde.rs | 15 |
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); +} |