diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-16 20:51:49 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-16 20:51:49 +0200 |
commit | f15da8ba3e62c76d23ea4ad87e5f45275885a016 (patch) | |
tree | 89447dc1ff9f44993ed5108ad43d5210819e07f8 /askama_derive/src/path.rs | |
parent | 7efd70297d12a643b858f006006c04b5d86b7d92 (diff) | |
download | askama-f15da8ba3e62c76d23ea4ad87e5f45275885a016.tar.gz askama-f15da8ba3e62c76d23ea4ad87e5f45275885a016.tar.bz2 askama-f15da8ba3e62c76d23ea4ad87e5f45275885a016.zip |
Change find_template_from_path() to take Path as start_at argument
Diffstat (limited to 'askama_derive/src/path.rs')
-rw-r--r-- | askama_derive/src/path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/askama_derive/src/path.rs b/askama_derive/src/path.rs index bf43568..3c04965 100644 --- a/askama_derive/src/path.rs +++ b/askama_derive/src/path.rs @@ -22,7 +22,7 @@ pub fn get_template_source(tpl_path: &Path) -> String { s } -pub fn find_template_from_path<'a>(path: &str, start_at: Option<&str>) -> PathBuf { +pub fn find_template_from_path<'a>(path: &str, start_at: Option<&Path>) -> PathBuf { let root = template_dir(); if let Some(rel) = start_at { let mut fs_rel_path = root.clone(); @@ -62,25 +62,25 @@ mod tests { #[test] fn find_absolute() { - let path = find_template_from_path("sub/b.html", Some("a.html")); + let path = find_template_from_path("sub/b.html", Some(Path::new("a.html"))); assert_eq!(path, Path::new("sub/b.html")); } #[test] #[should_panic] fn find_relative_nonexistent() { - find_template_from_path("b.html", Some("a.html")); + find_template_from_path("b.html", Some(Path::new("a.html"))); } #[test] fn find_relative() { - let path = find_template_from_path("c.html", Some("sub/b.html")); + let path = find_template_from_path("c.html", Some(Path::new("sub/b.html"))); assert_eq!(path, Path::new("sub/c.html")); } #[test] fn find_relative_sub() { - let path = find_template_from_path("sub1/d.html", Some("sub/b.html")); + let path = find_template_from_path("sub1/d.html", Some(Path::new("sub/b.html"))); assert_eq!(path, Path::new("sub/sub1/d.html")); } } |