| 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")
|