library(testthat) credential <- retrieve_credential_testing(268L) test_that("Russian Recruit", { testthat::skip_on_cran() expect_message( returned_object <- redcap_read_oneshot(redcap_uri=credential$redcap_uri, token=credential$token) ) d <- returned_object$data # d$recruitment_other # message(d$recruitment_other) expected_single <- "от сотрудницы" expected_multiple <- c("от сотрудницы", "мама и сестра", "подруга по общежитию") # expected_multiple <- c("a", "b", "c") # Encoding(expected_multiple) <- "latin1" # Sys.getlocale() # Experiment w/ Joe Cheng's answer at https://stackoverflow.com/questions/5031630/how-to-source-r-file-saved-using-utf-8-encoding # expect_equal(d$recruitment_other[1], expected_single) # expect_equal(d$recruitment_other, expected_multiple) }) # test_that("Russian Encoded", { # testthat::skip_on_cran() # expect_message( # returned_object <- redcap_read_oneshot(redcap_uri=uri, token=token) # ) # # d <- returned_object$data # d$recruitment_other # # expected <- c(" ", # " ", # " ") # iconv("н", "UTF-8") # iconv("s", "UTF-8") # iconv(d$recruitment_other, "latin1", "ASCII", sub = "byte") # expect_equal(d$recruitment_other, expected) # }) rm(credential)