| #' get_quos_names(-x) | #' get_quos_names(-x) | ||||
| #' get_quos_names(x:y) | #' get_quos_names(x:y) | ||||
| get_quos_names <- function(...) { | get_quos_names <- function(...) { | ||||
| q <- quos(...) | |||||
| sapply(q, function(i) as.character(i[[2]])) | |||||
| q <- rlang::quos(...) | |||||
| purrr::map_chr(q, rlang::quo_name) | |||||
| } | } | ||||
| #' Parses a simple vector so that it looks like its input | #' Parses a simple vector so that it looks like its input |
| context("test-tidyr_helpers") | |||||
| test_that("get_quos_names works", { | |||||
| expect_equivalent(get_quos_names(-x), "-x") | |||||
| expect_equivalent(get_quos_names(x:y), "x:y") | |||||
| expect_equivalent(get_quos_names(-x, -y, -z), c("-x", "-y", "-z")) | |||||
| }) |