blob: 4a42d6af40e79cdeaf7721674ea16026da3524fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
extern crate config;
use config::*;
fn make() -> Config {
let mut c = Config::default();
c.merge(File::new("tests/Settings", FileFormat::Toml))
.unwrap();
c.merge(File::new("tests/Settings-production", FileFormat::Toml))
.unwrap();
c
}
#[test]
fn test_merge() {
let c = make();
assert_eq!(c.get("debug").ok(), Some(false));
assert_eq!(c.get("production").ok(), Some(true));
assert_eq!(c.get("place.creator.name").ok(), Some("Somebody New".to_string()));
assert_eq!(c.get("place.rating").ok(), Some(4.9));
}
|