tests/testthat/test-writeLines.R

test_that("writeLines works", {
  tmp <- tempfile()
  on.exit(unlink(tmp))

  # Errors with connections
  con <- file(tmp)
  expect_error(writeLines("foo\nbar\n", con), "Only file paths are supported")
  close(con)

  # Warns if you use useBytes
  expect_warning(writeLines("foo\nbar\n", tmp, useBytes = TRUE), "is ignored")
})

Try the brio package in your browser

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

brio documentation built on Dec. 11, 2021, 10:09 a.m.