Add test for configuration file

This commit is contained in:
Kogia-sima 2020-07-14 18:59:39 +09:00
parent e277fe4a7d
commit 3267d60f1b
4 changed files with 21 additions and 0 deletions

1
Cargo.lock generated
View File

@ -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)",
]

View File

@ -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"

View File

@ -0,0 +1,6 @@
template_dir: "../templates"
escape: true
delimiter: "%"
optimization:
rm_whitespace: false

View File

@ -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);
}