AMR/tests/testthat/test-clipboard.R

25 lines
829 B
R
Raw Normal View History

2018-06-27 15:54:56 +02:00
context("clipboard.R")
test_that("clipboard works", {
2018-07-17 10:32:26 +02:00
if (!clipr::clipr_available() & Sys.info()['sysname'] == "Linux") {
# try to support on X11, by setting the R variable DISPLAY
Sys.setenv(DISPLAY = "localhost:10.0")
}
2018-06-27 15:54:56 +02:00
skip_if_not(clipr::clipr_available())
# clipboard_export(antibiotics)
# imp <- clipboard_import(guess_col_types = FALSE,
# stringsAsFactors = FALSE)
# expect_identical(as.data.frame(antibiotics, stringsAsFactors = FALSE),
# imp)
2018-06-29 08:56:03 +02:00
clipboard_export(septic_patients[1:100,])
2018-08-01 10:32:24 +02:00
imp <- clipboard_import(guess_col_types = TRUE,
stringsAsFactors = FALSE)
2018-07-17 19:51:09 +02:00
expect_identical(as.data.frame(tbl_parse_guess(septic_patients[1:100,]),
stringsAsFactors = FALSE),
2018-08-01 10:32:24 +02:00
imp)
2018-06-27 15:54:56 +02:00
})