diff options
author | John-John Tedro <udoprog@tedro.se> | 2018-05-07 05:36:09 +0200 |
---|---|---|
committer | John-John Tedro <udoprog@tedro.se> | 2018-05-07 05:36:41 +0200 |
commit | 2b40d542a0ea645c5e3c132aabc0082dffa2f554 (patch) | |
tree | f9b9c4a633e03cfaf942ef5d880e37428a1f7ba2 /test-suite/tests | |
parent | 579cf491e6cca04b5e4cfe63f3132eed1f2a4e93 (diff) | |
download | milf-rs-2b40d542a0ea645c5e3c132aabc0082dffa2f554.tar.gz milf-rs-2b40d542a0ea645c5e3c132aabc0082dffa2f554.zip |
Fix incorrectly reported spans for Datetime
Diffstat (limited to 'test-suite/tests')
-rw-r--r-- | test-suite/tests/spanned.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test-suite/tests/spanned.rs b/test-suite/tests/spanned.rs index c5dc28e..4339a0c 100644 --- a/test-suite/tests/spanned.rs +++ b/test-suite/tests/spanned.rs @@ -4,8 +4,26 @@ extern crate toml; extern crate serde_derive; use toml::Spanned; +use toml::value::Datetime; use std::collections::HashMap; +/// A set of good datetimes. +pub fn good_datetimes() -> Vec<&'static str> { + let mut v = Vec::new(); + v.push("1997-09-09T09:09:09Z"); + v.push("1997-09-09T09:09:09+09:09"); + v.push("1997-09-09T09:09:09-09:09"); + v.push("1997-09-09T09:09:09"); + v.push("1997-09-09"); + v.push("09:09:09"); + v.push("1997-09-09T09:09:09.09Z"); + v.push("1997-09-09T09:09:09.09+09:09"); + v.push("1997-09-09T09:09:09.09-09:09"); + v.push("1997-09-09T09:09:09.09"); + v.push("09:09:09.09"); + v +} + #[test] fn test_spanned_field() { #[derive(Deserialize)] @@ -40,4 +58,9 @@ fn test_spanned_field() { "foo = \"1997-09-09T09:09:09Z\"", "\"1997-09-09T09:09:09Z\"" ); + + for expected in good_datetimes() { + let s = format!("foo = {}", expected); + good::<Datetime>(&s, expected); + } } |