Closed cpovirk closed 1 year ago
I'm fine with proposed change. Perhaps add an inline comment for the reasoning?
Thanks. Added. Let me know what you think.
LGTM.
I looked at the history of this code and it seems like the current behavior is intentional.
Asking @marcphilipp or @sbrannen to provide a second approval, then I can merge.
Sadly no; it's a pretty weird setup that we have going—one of our systems for transpiling to another language, which we don't seem to have a way to support block-level suppressions for.
Sadly no; it's a pretty weird setup that we have going
OK. Thanks for the explanation.
The background is that we run this code through a compiler that complains about unused variables.
As I see it, it doesn't really make sense for the compiler to complain about an unused variable in this case. But given that it does, this could work around the problem for us.
Since there's no benefit to normal users from this PR, I'd also be OK with just maintaining a patch on our end. It's not hard; I just expect to be asked "Did you try to upstream this?" and so I'd like to be able to answer "yes" :)
In all this, I'm assuming that the looping is intentional. The other possibility would be that we're actually supposed to call
addChild
only once. But I'm assuming that theDescription
returned bygetDescription()
is supposed to include one entry for eachDescription
that will be created duringrun
.This appears to date back to https://github.com/junit-team/junit4/commit/e07e59eb9d24f6e4fa85dd99f311c1feca6ea983#diff-a36cb3d7d02522c18ce7059634d1cd9adabe56a773024708a53017d07d8900e7R29.
(Arguably, this PR makes the connection between
getDescription
andrun
clearer. But if we're concerned about that, maybe a code comment would be called for, and/or mayberun
should use an indexedfor
, too...?)