From bed28c1df5efb156de171efef65d44b4230c888e Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 18 Jan 2017 20:32:55 -0800 Subject: [PATCH] Resolve dependencies after the first (#149) The recipe dependency resolver had a bug which caused it to not resolve dependencies after the first. This caused the parameter check later in the program to crash. Added a test and fixed it. Fixes #148. --- src/integration.rs | 19 +++++++++++++++++++ src/lib.rs | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/integration.rs b/src/integration.rs index dee834d..4814c7b 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -1859,3 +1859,22 @@ BAZ +Z: "echo bar: 0\necho foo: 1 2\necho baz: 3 4 5\n", ); } + +#[test] +fn missing_second_dependency() { + integration_test( + &[], + " +x: + +a: x y +", + 255, + "", + "error: Recipe `a` has unknown dependency `y` + | +4 | a: x y + | ^ +", + ); +} diff --git a/src/lib.rs b/src/lib.rs index 2a50448..8645d14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -589,7 +589,7 @@ impl<'a, 'b> Resolver<'a, 'b> { .cloned().collect() })); } - return self.resolve(dependency); + self.resolve(dependency)?; }, None => return Err(dependency_token.error(ErrorKind::UnknownDependency { recipe: recipe.name,