Add test for configuration file
This commit is contained in:
parent
e277fe4a7d
commit
3267d60f1b
|
@ -665,6 +665,7 @@ version = "0.1.3"
|
|||
dependencies = [
|
||||
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sailfish 0.1.3",
|
||||
"sailfish-compiler 0.1.3",
|
||||
"sailfish-macros 0.1.3",
|
||||
"trybuild 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ publish = false
|
|||
[dependencies]
|
||||
sailfish = { path = "../sailfish" }
|
||||
sailfish-macros = { path = "../sailfish-macros" }
|
||||
sailfish-compiler = { path = "../sailfish-compiler" }
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0.28"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
template_dir: "../templates"
|
||||
escape: true
|
||||
delimiter: "%"
|
||||
|
||||
optimization:
|
||||
rm_whitespace: false
|
|
@ -0,0 +1,13 @@
|
|||
use sailfish_compiler::Config;
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn read_config() {
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("config");
|
||||
let config = Config::search_file_and_read(&*path).unwrap();
|
||||
|
||||
assert_eq!(config.delimiter, '%');
|
||||
assert_eq!(config.escape, true);
|
||||
assert_eq!(config.rm_whitespace, false);
|
||||
assert_eq!(config.template_dirs.len(), 1);
|
||||
}
|
Loading…
Reference in New Issue