File: test-active.R

package info (click to toggle)
r-cran-devtools 2.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,328 kB
  • sloc: sh: 15; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
test_that("find_active_file() gives useful error if no RStudio", {
  expect_snapshot(find_active_file(), error = TRUE)
})

test_that("fails if can't find tests", {
  expect_snapshot(error = TRUE, {
    find_test_file("R/foo.blah")
    find_test_file("R/foo.R")
  })
})

test_that("can determine file type", {
  expect_equal(test_file_type("R/foo.R"), "R")
  expect_equal(test_file_type("R/foo.c"), NA_character_)

  expect_equal(test_file_type("src/foo.c"), "src")
  expect_equal(test_file_type("src/foo.R"), NA_character_)

  expect_equal(test_file_type("tests/testthat/test-foo.R"), "test")
  expect_equal(test_file_type("tests/testthat/test-foo.c"), NA_character_)
  expect_equal(test_file_type("tests/testthat/foo.R"), NA_character_)

  expect_equal(test_file_type("DESCRIPTION"), NA_character_)
})