aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-12 13:30:05 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-12 13:30:05 +0100
commitafee9b771b28fe4f8f5f7a687cb7a50d82a3f707 (patch)
tree87cdb86218c5fbf4b1b69d910482940901eb0a47 /askama_shared
parente9f89e996fea5ccbf024122b0a816c5029b105ea (diff)
downloadaskama-afee9b771b28fe4f8f5f7a687cb7a50d82a3f707.tar.gz
askama-afee9b771b28fe4f8f5f7a687cb7a50d82a3f707.tar.bz2
askama-afee9b771b28fe4f8f5f7a687cb7a50d82a3f707.zip
Add some tests for Config contents
Diffstat (limited to 'askama_shared')
-rw-r--r--askama_shared/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs
index e9b368e..bff7b57 100644
--- a/askama_shared/src/lib.rs
+++ b/askama_shared/src/lib.rs
@@ -80,6 +80,22 @@ mod tests {
use std::env;
use std::path::{Path, PathBuf};
+ #[test]
+ fn test_default_config() {
+ let mut root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
+ root.push("templates");
+ let config = Config::from_str("");
+ assert_eq!(config.dirs, vec![root]);
+ }
+
+ #[test]
+ fn test_config_dirs() {
+ let mut root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
+ root.push("tpl");
+ let config = Config::from_str("dirs = [\"tpl\"]");
+ assert_eq!(config.dirs, vec![root]);
+ }
+
fn assert_eq_rooted(actual: &Path, expected: &str) {
let mut root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
root.push("templates");