tests/testthat/test_format_psv.R

test_that("Export to and import from PSV", {
    withr::with_tempfile("iris_file", fileext = ".psv", code = {
        export(iris, iris_file)
        expect_true(file.exists(iris_file))
        expect_true(is.data.frame(import(iris_file)))
    })
})


test_that("fread is deprecated", {
    withr::with_tempfile("iris_file", fileext = ".psv", code = {
        export(iris, iris_file)
        lifecycle::expect_deprecated(import(iris_file, fread = TRUE))
        lifecycle::expect_deprecated(import(iris_file, fread = FALSE))
    })

})

Try the rio package in your browser

Any scripts or data that you put into this service are public.

rio documentation built on June 22, 2024, 9:48 a.m.