forked from tidyverse/dplyr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from jennybc/master
- Loading branch information
Showing
4 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
compact <- function(x) Filter(Negate(is.null), x) | ||
|
||
names2 <- function(x) { | ||
names(x) %||% rep("", length(x)) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
context("lst") | ||
|
||
test_that("lst handles named and unnamed NULL arguments", { | ||
expect_equivalent(lst(NULL), list(NULL)) ## name is "" vs NULL :( | ||
expect_identical(lst(a = NULL), list(a = NULL)) | ||
expect_identical(lst(NULL, b = NULL, c = 1:3), | ||
list(NULL, b = NULL, c = 1:3)) | ||
}) | ||
|
||
test_that("lst handles internal references", { | ||
expect_identical(lst(a = 1, b = a), list(a = 1, b = 1)) | ||
expect_identical(lst(a = NULL, b = a), list(a = NULL, b = NULL)) | ||
}) |