Add tests for explicit context setting that check failure conditions and implement a helper function to generate a new breadcrumb stack.

This commit is contained in:
Tom Alexander
2020-05-25 15:40:42 -04:00
parent 8121c93392
commit 4a21ae5af3
6 changed files with 184 additions and 2 deletions

View File

@@ -42,6 +42,12 @@ where
B: Borrow<dyn ContextElement + 'a>,
P: Borrow<str>,
{
if breadcrumbs.is_empty() {
// This happens when you use a section with an explicit
// context path, where both the path and the explicit context
// path fail, leaving you with absolutely no context.
return Err(WalkError::CantWalk);
}
if path.is_empty() {
return Ok(breadcrumbs
.last()