The R Project SVN R

Rev

Rev 61820 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61820 Rev 72858
Line 1... Line 1...
1
setClass("B", contains = "numeric")
1
setClass("B", contains = "numeric")
2
xx <- new("B", 1)
2
xx <- new("B", 1)
3
stopifnot(is(tryCatch(names(xx) <- "A" , warning = function(e)e), "warning"))
-
 
4
names(xx) <- "A" # after this should not warn
3
names(xx) <- "A"
5
stopifnot(is(tryCatch(names(xx) <- "B" , warning = function(e)e), "character"))
4
stopifnot(identical(names(xx), "A"))
6
setClass("A", representation(xx = "numeric"))
5
setClass("A", representation(xx = "numeric"))
7
a <- new("A", xx = 1)
6
a <- new("A", xx = 1)
8
stopifnot(is(tryCatch(names(a) <- "A" , error = function(e)e), "error"))
7
stopifnot(is(tryCatch(names(a) <- "A" , error = function(e)e), "error"))
9
setClass("C", representation(xx = "numeric", names= "character"))
8
setClass("C", representation(xx = "numeric", names= "character"))
10
c <- new("C", xx = 1, names = "A")
9
c <- new("C", xx = 1, names = "A")