dwww Home | Show directory contents | Find package

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

  writeLines("foo\nbar\n", tmp)

  # Errors with connections
  con <- file(tmp)
  expect_error(readLines(con), "Only file paths are supported")
  close(con)

  # Warns if you use ok, warn, encoding or skipNul
  expect_warning(readLines(tmp, ok = TRUE), "is ignored")
  expect_warning(readLines(tmp, warn = TRUE), "is ignored")
  expect_warning(readLines(tmp, encoding = "Latin-1"), "is ignored")
  expect_warning(readLines(tmp, skipNul = TRUE), "is ignored")
})

Generated by dwww version 1.15 on Sat May 18 06:00:31 CEST 2024.