소스 검색

Refactor get_quos_name() and add tests for tidyr_helpers

pull/18/merge
Garrick Aden-Buie 8 년 전
부모
커밋
caa9188b69
2개의 변경된 파일과 9개의 추가작업 그리고 2개의 파일을 삭제
  1. +2
    -2
      R/tidyr_helpers.R
  2. +7
    -0
      tests/testthat/test-tidyr_helpers.R

+ 2
- 2
R/tidyr_helpers.R 파일 보기

@@ -12,8 +12,8 @@
#' get_quos_names(-x)
#' get_quos_names(x:y)
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

+ 7
- 0
tests/testthat/test-tidyr_helpers.R 파일 보기

@@ -0,0 +1,7 @@
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"))
})

Loading…
취소
저장