summaryrefslogtreecommitdiffstats
path: root/tests/file.rs
blob: a1b75068be24c01891658c96d3125b511ec242bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extern crate config;

use config::*;

#[test]
fn test_file_not_required() {
    let mut c = Config::default();
    let res = c.merge(File::new("tests/NoSettings", FileFormat::Yaml).required(false));

    assert!(res.is_ok());
}

#[test]
fn test_file_required_not_found() {
    let mut c = Config::default();
    let res = c.merge(File::new("tests/NoSettings", FileFormat::Yaml));

    assert!(res.is_err());
    assert_eq!(res.unwrap_err().to_string(),
               "configuration file \"tests/NoSettings\" not found"
                   .to_string());
}