summaryrefslogtreecommitdiffstats
path: root/tests/merge.rs
blob: df4ace8aea321c697ad8cdaca7d07e0a5d1416e2 (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!(c.get("debug").ok() == Some(false));
    assert!(c.get("production").ok() == Some(true));
    assert!(c.get("place.creator.name").ok() == Some("Somebody New".to_string()));
    assert!(c.get("place.rating").ok() == Some(4.9));
}