Skip to content

Commit

Permalink
Omit rownames from check (#5435)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand authored Oct 2, 2023
1 parent 69e7430 commit 72dcfad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ extract_target_is_likely_data <- function(x, data, env) {

tryCatch({
data_eval <- eval_tidy(x[[2]], data, env)
identical(data_eval, data)
identical(unrowname(data_eval), unrowname(data))
}, error = function(err) FALSE)
}

Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ test_that("warn_for_aes_extract_usage() warns for discouraged uses of $ and [[ w
warn_for_aes_extract_usage(aes(df[["x"]]), df),
'Use of `df\\[\\["x"\\]\\]` is discouraged'
)

# Check that rownames are ignored (#5392)
df2 <- df
rownames(df2) <- LETTERS[seq_len(nrow(df))]
expect_warning(
warn_for_aes_extract_usage(aes(df$x), df2),
"Use of `df\\$x` is discouraged"
)
})

test_that("warn_for_aes_extract_usage() does not evaluate function calls", {
Expand Down

0 comments on commit 72dcfad

Please sign in to comment.