File: init.R

package info (click to toggle)
r-cran-diffobj 0.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,432 kB
  • sloc: ansic: 455; javascript: 96; sh: 32; makefile: 8
file content (40 lines) | stat: -rwxr-xr-x 1,264 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Tests intended to be run with tools:::.runPackageTests() (i.e. R CMD check)
# Note, need to be loose with the directory check

if(nzchar(Sys.getenv('NOT_CRAN')))
  stopifnot(grepl('tests', basename(getwd())), exists("NAME"))

rdsf <-
  function(x) readRDS(file.path("_helper", "objs", NAME, sprintf("%s.rds", x)))
txtf <-
  function(x) readLines(file.path("_helper", "objs", NAME, sprintf("%s.txt", x)))

srdsf <- function(x, i)
  saveRDS(x, file.path("_helper", "objs", NAME, sprintf("%s.rds", i)), version=2)

stxtf <- function(x, i)
  writeLines(x, file.path("_helper", "objs", NAME, sprintf("%s.txt", i)))

library(diffobj)

all.opts <- c(
  list(
    useFancyQuotes=FALSE,   # all.equals uses fancy quotes
    diffobj.format="ansi8", # force ANSI colors
    diffobj.color.mode="yb",# force yb
    diffobj.pager="off",    # run tests without pager
    width=80L,
    encoding="UTF-8",        # so Gabor's name renders properly on win...
    warnPartialMatchArgs=TRUE,
    warnPartialMatchAttr=TRUE,
    warnPartialMatchDollar=TRUE
  )
)
options(c(diffobj_set_def_opts(), all.opts))

# tests predate 3.5.

if(R.version$major >= 4 || R.version$major >= 3 && R.version$minor >= "5.0")
  suppressWarnings(RNGversion("3.5.2"));

source("_helper/commonobjects.R")