Add test for using stage()
with a mapping specified for start
only
#6131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds tests to codify the behavior of
aes(stage(x))
and its variants working equivalently toaes(x)
.I had been under the impression that
stage(x)
will remain invalid since #4890 was closed without a follow-up (and with a general agreement that this is an odd thing to do), but that issue seems to have been resolved a while back as part of a larger PR in #5409. I assume that the currently working behavior ofstage(x)
is intended and desirable, and I would personally like for this to be guaranteed as a stable behavior (or at least, for there to be tests to detect its unintended regression).Hence, the PR adds three tests of equivalence between
aes(x)
and:aes(stage(x))
aes(stage(start = x))
aes(stage(start = x, after_stat = NULL, after_scale = NULL))
I saw some prior discussion on the significance of resolving an unnamed value passed to
start
, so the test includes both (1) and (2). I added (3) just for completeness, but can be removed if this is a weird thing to test (perhaps more meaningful is testing whether (3) works when other arguments are dynamically evaluated toNULL
, but I digress).In case
stage(x)
wasn't intended and the question of its desirability is still up in the air, I want to advocate for this with a pedagogical use-case: the practical equivalence betweenaes(x)
andaes(stage(x))
makes the introduction of more advanced strategies only one-step removed and thus easier to teach/learn, e.g.,aes(fill = stage(x, after_scale = darken(fill, .5)))