The R Project SVN R

Rev

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

Rev 56211 Rev 56572
Line 396... Line 396...
396
## now a subclass with another field & another layer of callSuper()
396
## now a subclass with another field & another layer of callSuper()
397
TestClass2 <- setRefClass("TestClass2",
397
TestClass2 <- setRefClass("TestClass2",
398
        contains = "TestClass",
398
        contains = "TestClass",
399
        fields = list( version = "integer"),
399
        fields = list( version = "integer"),
400
        methods = list(
400
        methods = list(
401
          initialize = function(..., version = 1)
401
          initialize = function(..., version = 0L)
402
              callSuper(..., version = version+1))
402
              callSuper(..., version = version+1L))
403
  )
403
  )
404
tt <- TestClass2$new("test", version = 1)
404
tt <- TestClass2$new("test", version = 1L)
405
stopifnot(identical(tt$text, "test:"), identical(tt$version, as.integer(2)))
405
stopifnot(identical(tt$text, "test:"), identical(tt$version, as.integer(2)))
406
tt <- TestClass2$new(version=3) # default text
406
tt <- TestClass2$new(version=3L) # default text
407
stopifnot(identical(tt$text, ":"), identical(tt$version, as.integer(4)))
407
stopifnot(identical(tt$text, ":"), identical(tt$version, as.integer(4)))
408
 
408
 
409
 
409
 
410
## test some capabilities but read-only for .self
410
## test some capabilities but read-only for .self
411
.changeAllFields <- function(replacement) {
411
.changeAllFields <- function(replacement) {