Skip to content

Commit

Permalink
always use encoding with readLines()
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed Oct 24, 2019
1 parent c4a1913 commit bcc2f61
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test_a_basics.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ test_that("user specified na strings work", {
)
git2rdata:::set_local_locale(old_locale)
expect_identical(
grep("junk", readLines(file.path(root, fn[1]))),
grep("junk", readLines(file.path(root, fn[1]), encoding = "UTF-8")),
2:4
)
expect_error(
Expand All @@ -279,7 +279,7 @@ test_that("user specified na strings work", {
)
git2rdata:::set_local_locale(old_locale)
expect_identical(
grep("junk", readLines(file.path(root, fn[1]))),
grep("junk", readLines(file.path(root, fn[1]), encoding = "UTF-8")),
2:4
)
file.remove(list.files(root, recursive = TRUE, full.names = TRUE))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_b_is_git2rmeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test_that("is_git2rdata checks data", {
junk <- write_vc(test_data, file = file, root = root, sorting = "test_Date")
correct_yaml <- yaml::read_yaml(file.path(root, junk[2]))
yaml::write_yaml(correct_yaml, file.path(root, junk[2]))
correct_data <- readLines(file.path(root, junk[1]))
correct_data <- readLines(file.path(root, junk[1]), encoding = "UTF-8")
junk_header <- correct_data
junk_header[1] <- "junk"
writeLines(junk_header, file.path(root, junk[1]))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_e_validate_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_that("read_vc() checks hash", {
test_that("read_vc() handles changes in rawdata", {
file <- basename(tempfile(tmpdir = root))
junk <- write_vc(test_data, file = file, root = root, sorting = "test_Date")
correct_data <- readLines(file.path(root, junk[1]))
correct_data <- readLines(file.path(root, junk[1]), encoding = "UTF-8")
correct_header <- strsplit(correct_data[1], "\t")[[1]]
junk_data <- correct_data
junk_data[1] <- paste(correct_header[-1], collapse = "\t")
Expand Down

0 comments on commit bcc2f61

Please sign in to comment.