File: test-warnings.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 (34 lines) | stat: -rwxr-xr-x 1,184 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
NAME <- "warnings"
source(file.path('_helper', 'init.R'))

# tests designed to produce warnings

# - Extra args for `str` -------------------------------------------------------

a <- "hello"
b <- "goodbye"

invisible(diffStr(a, b, extra=list(comp.str="^"))) # "Specifying"
invisible(diffStr(a, b, extra=list(comp="^"))) #  "Specifying")
invisible(diffStr(a, b, extra=list(indent.str="..."))) #  "Specifying"
invisible(diffStr(a, b, extra=list(indent="..."))) # "Specifying"

# - Max diffs ------------------------------------------------------------------

# Max limit warnings work properly; these are not fully fleshed out

A3 <- c("a b c", "d e f A B C D", "g h i", "f")
B3 <- c("a b c", "xd e f E Q L S", "g h i", "q")

invisible(diffChr(A3, B3, max.diffs=2)) # warn: "Exceeded diff"

# - Overriden formals ----------------------------------------------------------

# warn "Provided `style` argument will override the provided `format` argument"
invisible(diffChr(letters, LETTERS, style=StyleRaw(), format="ansi8"))

# warn: "Provided `style` .* `format` and `color.mode` arguments"
invisible(
  diffChr(letters, LETTERS, style=StyleRaw(), format="ansi8", color.mode="rgb")
)