Debian Codegraph @

tests/test-ci/test-session.R

raw
1 library(testit)
2
3 assert('session_info() strips BLAS/LAPACK/matrix-products and base-packages noise', {
4 si = session_info()
5 (!any(grepl('BLAS', si, fixed = TRUE)))
6 (!any(grepl('LAPACK', si, fixed = TRUE)))
7 (!any(grepl('Matrix products', si, fixed = TRUE)))
8 (!any(grepl('attached base packages', si, ignore.case = TRUE)))
9 # no consecutive blank lines
10 blank = !nzchar(trimws(si))
11 (!any(blank[-1] & blank[-length(blank)]))
12 })
13
14 assert('session_info() renames "other attached packages" and filters by package name', {
15 si_all = session_info()
16 (!any(grepl('other attached packages', si_all, ignore.case = TRUE)))
17 (any(grepl('Package version:', si_all, fixed = TRUE)))
18 # packages= restricts output to the named package
19 si = session_info('xfun', dependencies = FALSE)
20 ver = as.character(packageVersion('xfun'))
21 (any(grepl(paste0('xfun_', ver), si, fixed = TRUE)))
22 # empty strings in packages= are silently ignored
23 si2 = session_info(c('xfun', ''), dependencies = FALSE)
24 (identical(si, si2))
25 })