The R Project SVN R

Rev

Rev 75574 | Rev 80009 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75574 Rev 80007
Line -... Line 1...
-
 
1
require("tools")
-
 
2
 
1
x <- tools::Rd_db("base")
3
x <- tools::Rd_db("base")
2
system.time(y <- lapply(x, function(e)
4
system.time(y <- lapply(x, function(e)
3
    tryCatch(tools::Rd2HTML(e, out = nullfile()),
5
    tryCatch(tools::Rd2HTML(e, out = nullfile()),
4
	     error = identity))) # 3-5 sec
6
	     error = identity))) # 3-5 sec
5
stopifnot(!vapply(y, inherits, NA, "error"))
7
stopifnot(!vapply(y, inherits, NA, "error"))
6
## Gave error when "running" \Sexpr{.} DateTimeClasses.Rd
8
## Gave error when "running" \Sexpr{.} DateTimeClasses.Rd
-
 
9
 
-
 
10
 
-
 
11
## PR#18052: \dots must not be interpreted inside \preformatted
-
 
12
Rdsnippet <- tempfile()
-
 
13
writeLines(r"(\preformatted{
-
 
14
\item{\dots}{foo(arg = "\\\\dots", ...)}
-
 
15
})", Rdsnippet)
-
 
16
#file.show(Rdsnippet)
-
 
17
stopifnot(exprs = {
-
 
18
    identical(capture.output(Rd2HTML(Rdsnippet, fragment = TRUE))[2L],
-
 
19
              r"(\item{\dots}{foo(arg = "\\dots", ...)})")
-
 
20
    identical(capture.output(Rd2txt(Rdsnippet, fragment = TRUE))[2L],
-
 
21
              r"(\item{\dots}{foo(arg = "\\dots", ...)})")
-
 
22
    identical(capture.output(Rd2latex(Rdsnippet, fragment = TRUE))[2L],
-
 
23
              r"(\bsl{}item\{\bsl{}dots\}\{foo(arg = "\bsl{}\bsl{}dots", ...)\})")
-
 
24
}) # the last two failed in R < 4.1.0
-
 
25
 
-
 
26
## also do not translate \dots in R code lines in \examples
-
 
27
Rdsnippet <- tempfile()
-
 
28
writeLines(r"(\examples{
-
 
29
foo <- function(arg = "\\\\dots", ...) NULL # \dots
-
 
30
})", Rdsnippet)
-
 
31
#file.show(Rdsnippet)
-
 
32
stopifnot(exprs = {
-
 
33
    identical(capture.output(Rd2ex(parse_Rd(Rdsnippet), fragment = TRUE))[5L],
-
 
34
              r"(foo <- function(arg = "\\dots", ...) NULL # \dots)")
-
 
35
}) # failed in R < 4.1.0