Skip to content

Commit

Permalink
merge branch 'enhance/r-3-1', support R 3.1, re #40
Browse files Browse the repository at this point in the history
  • Loading branch information
nteetor committed Feb 5, 2018
2 parents 5367f20 + a5205ff commit 7a5621e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ sudo: false
cache: packages
warnings_are_errors: false

r:
- 3.1
- 3.2
- oldrel
- release
- devel

r_packages:
- covr

Expand Down
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Authors@R: c(
person(given = "Nathan", family = "Teetor", email = "[email protected]", role = c("aut", "cre")),
person(given = "Paul", family = "Teetor", role = "ctb"))
Description: Provides a %<-% operator to perform multiple,
unpacking, and destructuring assignment in R. The
unpacking, and destructuring assignment in R. The
operator unpacks the right-hand side of an assignment
into multiple values and assigns these values to
into multiple values and assigns these values to
variables on the left-hand side of the assignment.
URL: https://github.com/nteetor/zeallot
BugReports: https://github.com/nteetor/zeallot/issues
Expand All @@ -17,6 +17,8 @@ Encoding: UTF-8
RoxygenNote: 6.0.1
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
Depends:
R (>= 3.1)
Suggests:
testthat,
knitr,
Expand Down
14 changes: 10 additions & 4 deletions tests/testthat/test-destructure.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ test_that("destructure atomics", {
)
})

test_that("destructure data.frame converts data.frame to list", {
test_that("destructure.data.frame converts data frame to list", {
sample_df <- head(iris)
expect_equal(destructure(sample_df), as.list(sample_df))
destruct_df <- destructure(sample_df)

expect_equal(destruct_df, as.list(sample_df))
expect_equal(length(sample_df), NCOL(sample_df))
expect_true(all(lengths(destructure(sample_df)) == NROW(sample_df)))

expect_true(all(
vapply(destruct_df, function(x) length(x) == NROW(sample_df), logical(1))
))

for (i in seq_len(NCOL(sample_df))) {
expect_equal(destructure(sample_df)[[i]], sample_df[[i]])
expect_equal(destruct_df[[i]], sample_df[[i]])
}
})

Expand Down

0 comments on commit 7a5621e

Please sign in to comment.