Browse Source

An unreached symbol forces all further symbols in the tuple

master
Adrian Heine 5 years ago
parent
commit
10edcd4282
  1. 9
      src/setup.rs

9
src/setup.rs

@ -129,7 +129,7 @@ macro_rules! runnable_for_tuple {
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;
let mut result = false; let mut result = false;
$(result = runner.run_symbol($name, force)? || result;)*
$(result = runner.run_symbol($name, force || result)? || result;)*
Ok(result) Ok(result)
} }
} }
@ -355,9 +355,14 @@ mod test {
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: false }), false).unwrap(); setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: false }), false).unwrap();
assert_eq!(*count.borrow(), 1); assert_eq!(*count.borrow(), 1);
// An unreached symbol forces all further symbols
let (count, setup) = get_setup(); let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: false }, TestSymbol { reached: true }), false).unwrap(); 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(); let (count, setup) = get_setup();
setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: true }), true).unwrap(); setup.run_symbol((TestSymbol { reached: true }, TestSymbol { reached: true }), true).unwrap();

Loading…
Cancel
Save