-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with date-variables for compact-functions (#966)
* Fix issue with date-variables for compact-functions * lintr
- Loading branch information
1 parent
e61c9f6
commit 8194b51
Showing
5 changed files
with
21 additions
and
8 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
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,8 +1,12 @@ | ||
test_that("compact character works as expected", { | ||
expect_equal(compact_character(c("x", "y", NA)), c("x", "y")) | ||
expect_equal(compact_character(c("x", "y", NA_real_)), c("x", "y")) | ||
expect_equal(compact_character(c("x", "NULL", "", "y")), c("x", "y")) | ||
expect_identical(compact_character(c("x", "y", NA)), c("x", "y")) | ||
expect_identical(compact_character(c("x", "y", NA_real_)), c("x", "y")) | ||
expect_identical(compact_character(c("x", "NULL", "", "y")), c("x", "y")) | ||
|
||
# scalar | ||
expect_equal(compact_character(""), character(0)) | ||
expect_identical(compact_character(""), character(0)) | ||
|
||
# date | ||
x <- as.Date(c("1900-05-06", "", "1900-05-07", NA)) | ||
expect_identical(compact_character(x), structure(c(-25442, -25441), class = "Date")) | ||
}) |
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