tests/testthat/test-tree.R

test_that("dir_tree() works", {
  withr::with_options(c("cli.unicode" = FALSE), {
    with_dir_tree(list("foo/1" = ""), {
      expect_snapshot(dir_tree("foo"))
    })
  })

  withr::with_options(c("cli.unicode" = FALSE), {
    with_dir_tree(list("foo/1" = "", "foo/2" = "", "foo/3" = "", "foo/4" = ""), {
      expect_snapshot(dir_tree("foo"))
    })
  })

  withr::with_options(c("cli.unicode" = FALSE), {
    with_dir_tree(list("foo/bar/1" = "", "foo/bar/baz/2" = "", "foo/qux/3" = "", "foo/4" = ""), {
      expect_snapshot(dir_tree("foo"))
    })
  })
})

Try the fs package in your browser

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

fs documentation built on Oct. 30, 2024, 9:06 a.m.