Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
tests: Don't assert(...) with side effects #14088
From the developer notes:
These assertions were introduced quite recently (in #14069 which was merged two days ago) and since this is a recurring thing (see #13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.
referenced this pull request
Aug 28, 2018
Thanks :) utACK 1916b4e
If you're worried about somebody trying to run a node with
@skeees Yes, the regression test will only catch this specific type of side effect. The regression test is not meant to be exhaustive (regression tests seldom are! :-)).
FWIW, this is the third time this specific type of side effect is fixed during the past few months so having a check for this is better than no checking :-)
@skeees Updated version based on your feedback with improved comments. Now catching also accidental assignment operations in assertions :-)
From PRE31-C (SEI CERT C Coding Standard):
Now catching all three.
Cool - utACK - I think this change makes things strictly better. Regarding
I do think its worth changing the