diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-03-26 17:44:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 17:44:02 +0100 |
commit | 225005994d46e634918568b9013cfae82c491a8a (patch) | |
tree | ba023a11f997377b8d0bd6f69d1a86def5060108 | |
parent | 424b261532ef92d6d9e1d9156c52e657bfa1a37a (diff) | |
parent | c80cf417fcb7134cf595b3889ddf4fdaac4fa790 (diff) |
Merge pull request #187 from matthiasbeyer/test-json-sequence
Add tests for json value array
-rw-r--r-- | tests/file_json.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/file_json.rs b/tests/file_json.rs index 307312e..2c614e1 100644 --- a/tests/file_json.rs +++ b/tests/file_json.rs @@ -81,3 +81,24 @@ fn test_error_parse() { ) ); } + +#[test] +fn test_json_vec() { + let c = Config::default() + .merge(File::from_str( + r#" + { + "WASTE": ["example_dir1", "example_dir2"] + } + "#, + FileFormat::Json, + )) + .unwrap() + .clone(); + + let v = c.get_array("WASTE").unwrap(); + let mut vi = v.into_iter(); + assert_eq!(vi.next().unwrap().into_str().unwrap(), "example_dir1"); + assert_eq!(vi.next().unwrap().into_str().unwrap(), "example_dir2"); + assert!(vi.next().is_none()); +} |