blob: f83eef86e50060e17ee3087ca246c74a8496b4dd (
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
25
26
27
|
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));
}
|