Skip to content

Commit 36d1fb1

Browse files
committed
Use ParserStateChanged information to determine TestRefreshes
This notably avoids the use of an additional flag to provide this functionality.
1 parent 1895768 commit 36d1fb1

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Rubberduck.UnitTesting/UnitTesting/TestEngine.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ internal class TestEngine : ITestEngine
3939
public bool CanRun => AllowedRunStates.Contains(_state.Status);
4040
public bool CanRepeatLastRun => LastRun.Any();
4141

42-
private bool _testsRunning;
4342
private bool refreshBackoff;
4443

4544

@@ -89,7 +88,7 @@ private void StateChangedHandler(object sender, ParserStateEventArgs e)
8988
refreshBackoff = false;
9089
}
9190
// CanRun returned true already, only refresh tests if we're not backed off
92-
else if (!refreshBackoff && !_testsRunning)
91+
else if (!refreshBackoff && e.OldState != ParserState.Busy)
9392
{
9493
refreshBackoff = true;
9594
Tests = TestDiscovery.GetAllTests(_state);
@@ -129,12 +128,7 @@ private void RunInternal(IEnumerable<TestMethod> tests)
129128
{
130129
return;
131130
}
132-
// FIXME we shouldn't need to handle awaiting a certain parser state ourselves anymore, right?
133-
// that would drop the _testsRequested member completely
134-
// _testsRunning avoids raising a TestsRefreshed event when exiting the parser suspension
135-
_testsRunning = true;
136131
_state.OnSuspendParser(this, AllowedRunStates, () => RunWhileSuspended(tests));
137-
_testsRunning = false;
138132
}
139133

140134
private void EnsureRubberduckIsReferencedForEarlyBoundTests()

0 commit comments

Comments
 (0)