Sorry I’m probably sounding too cranky about this.
😀 no worries. Please always be as vocal as possible, we all just want to ensure good changes occur.
There is one hidden bug case that the original code wouldn’t detect. And another that this version does a (very slightly) better job of diagnosing.
Scenario A: No Actual console response
The QEventLoop
will quit when the textChanged
signal is received. But, this is supposed to be received twice. When you enter a command, the textChanged
signal will be emitted because the command you entered will now be present. Then the console will present the output to your command and another textChanged
signal will be emitted.
Now, let’s say we introduce a bug where the console fails to present output to your command. The old version will pass on the QEventLoop
but detect this when it searches for the current chain value and compares it with “regtest”. The new version will fail earlier because the signal wasn’t received twice. This makes it (very slightly) easier to diagnose what we did wrong because we are counting the signal emissions.
Scenario B: Double console response
If we introduce a bug where the console starts to output responses twice, the old version cannot detect this. The chain value will be found and the old test will say everything looks good. The new version will know something is wrong because the signal would have been received three times instead of 2 and the test will fail.
Furthermore, let’s say we introduce a bug where a textChanged
signal is never emitted. The old test will hang indeterminately. The new test will time out and the CI can continue to test other things.