Skip to content

Commit

Permalink
Check that vars_select() can drop duplicates by position
Browse files Browse the repository at this point in the history
Closes r-lib#94
  • Loading branch information
lionel- committed Sep 23, 2019
1 parent e0813f3 commit 71add7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/testthat/test-vars-select.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,9 @@ test_that("select helpers support redundantly named vectors", {
expect_identical(vars_select(c("a", "b", "a"), one_of(c("b", "a"))), c(b = "b", a...2 = "a", a...3 = "a"))
expect_identical(vars_select(c("a1", "b", "a1", "a2"), b, num_range("a", 1:2)), c(b = "b", a1...2 = "a1", a1...3 = "a1", a2 = "a2"))
})

test_that("vars_select() can drop duplicate names by position (#94)", {
expect_identical(vars_select(c("a", "b", "a"), 2), c(b = "b"))
expect_identical(vars_select(c("a", "b", "a"), -3), c(a = "a", b = "b"))
expect_identical(vars_select(c("a", "b", "a"), -1), c(b = "b", a = "a"))
})

0 comments on commit 71add7e

Please sign in to comment.