File: test_constructor.R

package info (click to toggle)
r-cran-fail 1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 188 kB
  • sloc: sh: 9; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
context("Constructor")

test_that("Creation of directories and checking of existing files", {
  path = tempfile()
  fail(path) # works on new dirs
  fail(path) # works on existing dirs
  path = tempfile()
  file.create(path)
  expect_error(fail(path))
})

test_that("Constructor checks input", {
  path = tempfile()
  expect_error(fail(path, extension="^"))
  expect_error(fail(path, extension=".RData"))
})

test_that("Argument 'all.files' works", {
  path = tempfile()
  f = fail(path, all.files = FALSE)
  expect_error(f$put(.x = 1), "hidden")

  f = fail(path, all.files = TRUE)
  f$put(.x = 1)
  expect_equal(f$ls(), ".x")
})