-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from TheNeikos/feature/add_hashmap_test
Feature/add hashmap test
- Loading branch information
Showing
7 changed files
with
58 additions
and
184 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#![allow(dead_code)] | ||
use std::collections::HashMap; | ||
|
||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Deserialize)] | ||
struct Outer { | ||
values: HashMap<String, String>, | ||
inner: Inner, | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
struct Inner { | ||
more_values: HashMap<String, String>, | ||
} | ||
|
||
#[test] | ||
fn parse_hashmap() { | ||
let vars = [ | ||
("values__0key", ("first key")), | ||
("values__0val", ("first value")), | ||
("values__1key", ("second key")), | ||
("values__1val", ("second value")), | ||
("inner__more_values__0key", ("first inner key")), | ||
("inner__more_values__0val", ("first inner value")), | ||
]; | ||
|
||
let config: Outer = envious::Config::new().build_from_iter(vars).unwrap(); | ||
println!("{:#?}", config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters