From 10edcd42826bca247f129c768507aaa1d5fe4c0a Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Sun, 3 May 2020 13:13:25 +0200 Subject: [PATCH] An unreached symbol forces all further symbols in the tuple --- src/setup.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/setup.rs b/src/setup.rs index 2ea075a..44e5d7f 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -129,7 +129,7 @@ macro_rules! runnable_for_tuple { fn run<_R: SymbolRunner>(&self, runner: &_R, force: bool) -> Result> { 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();