Added a test for backtracking.
DustJS appears to not do any backtracking.
This commit is contained in:
@@ -178,7 +178,7 @@ impl<'a> DustRenderer<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn walk_path<'a>(
|
||||
fn new_walk_path<'a>(
|
||||
context: &'a dyn ContextElement,
|
||||
path: &Vec<&str>,
|
||||
breadcrumbs: Vec<&'a dyn ContextElement>,
|
||||
@@ -192,6 +192,21 @@ fn walk_path<'a>(
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
// TODO: rename walk_path_from_single_level
|
||||
/// Attempts to walk a path from only 1 level in the context breadcrumbs
|
||||
fn walk_path<'a>(
|
||||
context: &'a dyn ContextElement,
|
||||
path: &Vec<&str>,
|
||||
) -> Result<&'a dyn ContextElement, RenderError<'a>> {
|
||||
let mut output = context;
|
||||
|
||||
for elem in path.iter() {
|
||||
output = output.walk(elem)?;
|
||||
}
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user