The R Project SVN R

Rev

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

Rev 76688 Rev 76848
Line 1738... Line 1738...
1738
op <- options(deparse.max.lines = 3)
1738
op <- options(deparse.max.lines = 3)
1739
f <- function(...) browser()
1739
f <- function(...) browser()
1740
do.call(f, mtcars)
1740
do.call(f, mtcars)
1741
c
1741
c
1742
 
1742
 
1743
options(error = expression(NULL))
1743
op <- c(op, options(error = expression(NULL)))
1744
f <- function(...) stop()
1744
f <- function(...) stop()
1745
do.call(f, mtcars)
1745
do.call(f, mtcars)
1746
traceback()
1746
traceback()
1747
 
1747
 
1748
## Debugger can handle a function that has a single function call as its body
1748
## Debugger can handle a function that has a single function call as its body
Line 2612... Line 2612...
2612
## R < 2.15.1 got these as FALSE, TRUE, FALSE.
2612
## R < 2.15.1 got these as FALSE, TRUE, FALSE.
2613
 
2613
 
2614
 
2614
 
2615
library("methods")# (not needed here)
2615
library("methods")# (not needed here)
2616
assertError <- tools::assertError
2616
assertError <- tools::assertError
-
 
2617
assertErrorV <- function(expr) assertError(expr, verbose=TRUE)
2617
assertError( getMethod(ls, "bar", fdef=ls), verbose=TRUE)
2618
assertErrorV( getMethod(ls, "bar", fdef=ls) )
2618
assertError( getMethod(show, "bar"), verbose=TRUE)
2619
assertErrorV( getMethod(show, "bar") )
2619
## R < 2.15.1 gave
2620
## R < 2.15.1 gave
2620
##   cannot coerce type 'closure' to vector of type 'character'
2621
##   cannot coerce type 'closure' to vector of type 'character'
2621
 
2622
 
2622
 
2623
 
2623
## corner cases for array
2624
## corner cases for array
Line 3064... Line 3065...
3064
sprintf("%d", c(1,2))
3065
sprintf("%d", c(1,2))
3065
sprintf("%d", c(1,NA))
3066
sprintf("%d", c(1,NA))
3066
sprintf("%d", c(NA,1))
3067
sprintf("%d", c(NA,1))
3067
##
3068
##
3068
## these should fail
3069
## these should fail
3069
sprintf("%d", 1.1)
3070
assertErrorV( sprintf("%d", 1.1) )
3070
sprintf("%d", c(1.1,1))
3071
assertErrorV( sprintf("%d", c(1.1,1)) )
3071
sprintf("%d", c(1,1.1))
3072
assertErrorV( sprintf("%d", c(1,1.1)) )
3072
sprintf("%d", NaN)
3073
assertErrorV( sprintf("%d", NaN) )
3073
sprintf("%d", c(1,NaN))
3074
assertErrorV( sprintf("%d", c(1,NaN)) )
3074
 
3075
 
3075
 
3076
 
3076
## formatting of named raws:
3077
## formatting of named raws:
3077
setNames(as.raw(1:3), c("a", "bbbb", "c"))
3078
setNames(as.raw(1:3), c("a", "bbbb", "c"))
3078
## was quite ugly for R <= 3.4.2
3079
## was quite ugly for R <= 3.4.2