From 9e2aaefccade80a3b4cae4293b094acd9e109028 Mon Sep 17 00:00:00 2001 From: nteetor Date: Mon, 5 Feb 2018 07:11:42 -0800 Subject: [PATCH 1/2] update travis config and description file, re #40 --- .travis.yml | 7 +++++++ DESCRIPTION | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e4a89d..549e9f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,13 @@ sudo: false cache: packages warnings_are_errors: false +r: + - 3.1 + - 3.2 + - oldrel + - release + - devel + r_packages: - covr diff --git a/DESCRIPTION b/DESCRIPTION index cff9f04..900e671 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,9 +6,9 @@ Authors@R: c( person(given = "Nathan", family = "Teetor", email = "nathanteetor@gmail.com", 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 @@ -17,6 +17,8 @@ Encoding: UTF-8 RoxygenNote: 6.0.1 Roxygen: list(markdown = TRUE) VignetteBuilder: knitr +Depends: + R (>= 3.1) Suggests: testthat, knitr, From a5205ff06888bd97f2a51fc0cd090beb3efdb2ab Mon Sep 17 00:00:00 2001 From: nteetor Date: Mon, 5 Feb 2018 07:42:17 -0800 Subject: [PATCH 2/2] replace call to lengths() in destructure tests, re #40 --- tests/testthat/test-destructure.R | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-destructure.R b/tests/testthat/test-destructure.R index 7deefbf..027dc0e 100644 --- a/tests/testthat/test-destructure.R +++ b/tests/testthat/test-destructure.R @@ -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]]) } })