File: test_splitPath.R

package info (click to toggle)
r-cran-bbmisc 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,256 kB
  • sloc: ansic: 176; sh: 9; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
context("splitPath")

test_that("splitPath", {
  p = tempfile()
  res = splitPath(p)
  expect_true(is.list(res))
  expect_equal(names(res), c("drive", "path"))
  expect_true(length(res$drive) == as.integer(isWindows()))
  expect_true(is.character(res$path))
  expect_true(length(res$path) >= 1L)

  p = c("tmp", "foo", "", "bar")
  res = splitPath(collapse(p, "/"))
  expect_equal(tail(res$path, 3), p[-3])
  res = splitPath(collapse(p, "\\"))
  expect_equal(tail(res$path, 3), p[-3])
})