-
Notifications
You must be signed in to change notification settings - Fork 333
WIP: explore auto-labelling with values #2142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
label <- expr_label(expr) | ||
if (can_inline(value)) { | ||
paste0(label, " (", as_label(value), ")") | ||
} else { | ||
label | ||
} | ||
} else { | ||
expr_label(expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd avoid expr_label()
as it's a remnant from lazyeval. Do you get good results if you use as_label()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and it introduced a bunch of small changes that were largely for the worse. I think this must have deviated from as_label
at some time in the past.
} | ||
} | ||
|
||
can_inline <- function(x) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rlang::is_syntactic_literal()
might also be useful here? Would still need the nchar check.
@@ -1,34 +1,34 @@ | |||
# logical tests act as expected | |||
|
|||
FALSE (`actual`) is not equal to TRUE (`expected`). | |||
FALSE is not equal to TRUE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we quote the expressions?
FALSE is not equal to TRUE. | |
`FALSE` is not equal to `TRUE`. |
I guess this becomes too heavy in the parenthetised/string-quoted cases
x` (`1`) is not identical to `"a"`.
`x1` (`actual`) doesn't fully contain all the values in `x2` (`expected`). | ||
* Missing from `actual`: "d" | ||
* Present in `actual`: "a", "b", "c" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually a case where the parameter names are useful and add context (as opposed to e.g. object
).
No description provided.