The R Project SVN R

Rev

Rev 70362 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20124 ripley 1
#### STRICT test suite in the spirit of no-segfaults,
2
#### but with explicit statements.
3
 
85382 maechler 4
tools::assertError(options(catch.script.errors = NA)) # TRUE or FALSE
5
options(catch.script.errors = TRUE)
6
stop("test of 'options(catch.script.errors = TRUE)'")
20124 ripley 7
 
8
if(FALSE) {
9
## these ought to work on machines with enough memory
10
## These segfaulted in 1.3.x ,  give "could not allocate" errors now
11
  integer(2^30+1)
12
   double(2^30+1)
13
  complex(2^30+1)
14
character(2^30+1)
15
vector("list", 2^30+2)
16
}
39826 maechler 17
 
42973 maechler 18
## bad infinite recursion / on.exit / ... interactions
70362 luke 19
##   catch the error to permit different error messages emitted
20
##   (handling of infinite recursion is different in the AST interpreter
21
##   and the byte-code interpreter)
22
 
69945 luke 23
bar <- function() 1+1
24
foo <- function() { on.exit(bar()); foo() }
70362 luke 25
tryCatch(foo(), error=function(x) TRUE) # now simple "infinite recursion"