diff options
author | Ryan Leckey <ryan@launchbadge.com> | 2017-06-14 00:28:43 -0700 |
---|---|---|
committer | Ryan Leckey <ryan@launchbadge.com> | 2017-06-14 00:28:43 -0700 |
commit | 1716c2fe7571b03215a5ae09c91f508d03335c2a (patch) | |
tree | f2b3144044f907c8eb1c594460d6cd74eed92b1f /tests/file.rs | |
parent | 9a2e756075dce24e764c8c89e2d71703a69fd80a (diff) | |
parent | 736738a2a798d58b1a73b0da146924a7e92ceba3 (diff) |
Merge branch 'feature/with_name' of https://github.com/JordiPolo/config-rs into JordiPolo-feature/with_name
Diffstat (limited to 'tests/file.rs')
-rw-r--r-- | tests/file.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/file.rs b/tests/file.rs index 4dba71f..04a7361 100644 --- a/tests/file.rs +++ b/tests/file.rs @@ -29,3 +29,23 @@ fn test_file_auto() { assert_eq!(c.get("debug").ok(), Some(false)); assert_eq!(c.get("production").ok(), Some(true)); } + +#[test] +fn test_file_auto_not_found() { + let mut c = Config::default(); + let res = c.merge(File::with_name("tests/NoSettings")); + + assert!(res.is_err()); + assert_eq!(res.unwrap_err().to_string(), + "configuration file \"tests/NoSettings\" not found" + .to_string()); +} + +#[test] +fn test_file_ext() { + let mut c = Config::default(); + c.merge(File::with_name("tests/Settings.json")).unwrap(); + + assert_eq!(c.get("debug").ok(), Some(true)); + assert_eq!(c.get("production").ok(), Some(false)); +} |