An unreached symbol forces all further symbols in the tuple

This commit is contained in:
Adrian Heine 2020-05-03 13:13:25 +02:00
parent 0a4019ea19
commit 10edcd4282

View file

@ -129,7 +129,7 @@ macro_rules! runnable_for_tuple {
fn run<_R: SymbolRunner>(&self, runner: &_R, force: bool) -> Result<bool, Box<dyn Error>> {
let ($($name,)*) = self;
let mut result = false;
$(result = runner.run_symbol($name, force)? || result;)*
$(result = runner.run_symbol($name, force || result)? || result;)*
Ok(result)
}
}
@ -355,9 +355,14 @@ mod test {
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: false }), false).unwrap();
assert_eq!(*count.borrow(), 1);
// An unreached symbol forces all further symbols
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: false }, TestSymbol { reached: true }), false).unwrap();
assert_eq!(*count.borrow(), 1);
assert_eq!(*count.borrow(), 2);
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: true }), false).unwrap();
assert_eq!(*count.borrow(), 0);
let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: true }), true).unwrap();