Skip to content

Commit

Permalink
fix stringAsFactors in tests for r-old-release
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Mar 5, 2021
1 parent ac465dc commit 2f63f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/testthat/test-independent_test_collate.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ find_files <- function(pkg, dir, pattern) {
full.names = TRUE
) %>%
gsub(pattern = paste0(".*", pkg, "/{1}"), replacement = "") %>%
as.data.frame()
as.data.frame(stringsAsFactors = FALSE)
names(d)[1] <- "files"
d
}
Expand Down Expand Up @@ -141,7 +141,9 @@ testthat::test_that("print returns a data frame as expected", {
files <- pkg %>% find_files(dir = "vignettes", pattern = "*")
expected <- data.frame(
"path_rel" = files$files,
"format" = rep("text", length(files$files)))
"format" = rep("text", length(files$files)),
stringsAsFactors = FALSE
)
testthat::expect_identical(actual[, -1], expected)
})

Expand All @@ -155,7 +157,8 @@ testthat::test_that("create_fc_df returns the data frame correctly", {
expected <- data.frame(
"path_abs" = rep(NA, n_row),
"path_rel" = rep(NA, n_row),
"format" = rep(NA, n_row)
"format" = rep(NA, n_row),
stringsAsFactors = FALSE
)
testthat::expect_identical(expected, create_fc_df(n_row))
})
2 changes: 1 addition & 1 deletion tests/testthat/test-independent_test_unpack.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ find_files <- function(pkg, dir, pattern) {
full.names = TRUE
) %>%
gsub(pattern = paste0(".*", pkg, "/{1}"), replacement = "") %>%
as.data.frame()
as.data.frame(stringsAsFactors = FALSE)
names(d)[1] <- "files"
d
}
Expand Down

0 comments on commit 2f63f4e

Please sign in to comment.