Compare commits

...

2 commits

Author SHA1 Message Date
0a4019ea19 Correctly run tuples 2020-05-03 12:07:20 +02:00
59253eadb1 Fix key and cert bundles 2020-05-03 12:06:02 +02:00
2 changed files with 23 additions and 2 deletions

View file

@ -161,7 +161,7 @@ impl<D: Clone> SymbolBuilder<KeyAndCertBundle<D>> for DefaultBuilder {
target: &<KeyAndCertBundle<D> as Resource>::Artifact, target: &<KeyAndCertBundle<D> as Resource>::Artifact,
(cert_chain, key): <Self::Prerequisites as ToArtifact>::Artifact, (cert_chain, key): <Self::Prerequisites as ToArtifact>::Artifact,
) -> Self::Symbol { ) -> Self::Symbol {
ConcatSymbol::new([cert_chain.0, key.0], target.0.clone()) ConcatSymbol::new([key.0, cert_chain.0], target.0.clone())
} }
} }

View file

@ -128,7 +128,9 @@ macro_rules! runnable_for_tuple {
#[allow(unused)] #[allow(unused)]
fn run<_R: SymbolRunner>(&self, runner: &_R, force: bool) -> Result<bool, Box<dyn Error>> { fn run<_R: SymbolRunner>(&self, runner: &_R, force: bool) -> Result<bool, Box<dyn Error>> {
let ($($name,)*) = self; let ($($name,)*) = self;
Ok($(runner.run_symbol($name, force)? || )* false) let mut result = false;
$(result = runner.run_symbol($name, force)? || result;)*
Ok(result)
} }
} }
); );
@ -342,4 +344,23 @@ mod test {
setup.add(TestResource("A", "B")).unwrap(); setup.add(TestResource("A", "B")).unwrap();
assert_eq!(*count.borrow(), 0); assert_eq!(*count.borrow(), 0);
} }
#[test]
fn correctly_handles_symbol_tuples() {
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: false }, TestSymbol { reached: false }), false).unwrap();
assert_eq!(*count.borrow(), 2);
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: false }), false).unwrap();
assert_eq!(*count.borrow(), 1);
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: false }, TestSymbol { reached: true }), false).unwrap();
assert_eq!(*count.borrow(), 1);
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: true }), true).unwrap();
assert_eq!(*count.borrow(), 2);
}
} }