1# to avoid variability on terminals with different capabilities
2# plus generally random options being set
3
4if(getRversion() < "3.2.2") {
5  warning("Cannot run tests with R version less than 3.2.2.")
6} else if(!suppressWarnings(require('fansi'))) {
7  # this is to avoid accidentally running tests under valgrind without fansi
8  # installed... (no, we've never done this...)
9  warning("Cannot run tests without package `fansi`")
10} else if(!suppressWarnings(require('unitizer'))) {
11  warning("Cannot run tests without package `unitizer`")
12} else {
13  old.opt <- options(
14    fansi.tabs.as.spaces=FALSE,
15    fansi.tab.stops=8L,
16    fansi.warn=TRUE,
17    fansi.term.cap=c('bright', '256')
18    # warnPartialMatchArgs = TRUE,
19    # warnPartialMatchAttr = TRUE,
20    # warnPartialMatchDollar = TRUE
21  )
22  on.exit(old.opt)
23  unitize_dir(
24    'unitizer',
25    pattern="has|misc|nchar|overflow|strip|strsplit|substr|tabs|tohtml|wrap",
26    state='recommended'
27  )
28  # we skip utf8 tests on solaris due to the problems with deparse (and maybe
29  # others, don't have a solaris system handy for testing)
30
31  if(!grepl("solaris|sun", Sys.info()[['sysname']], ignore.case=TRUE)) {
32    unitize('unitizer/utf8.R')
33  }
34}
35