The R Project SVN R

Rev

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

Rev 90183 Rev 90279
Line 2... Line 2...
2
#### - Started by moving checks from ./reg-S4.R:
2
#### - Started by moving checks from ./reg-S4.R:
3
###	all "Matrix" + "late_and_no-relevant-print" now here
3
###	all "Matrix" + "late_and_no-relevant-print" now here
4
#### - No *.Rout.save <==> use stopifnot() etc for testing
4
#### - No *.Rout.save <==> use stopifnot() etc for testing
5
#### - Recommended packages allowed, e.g., "Matrix"
5
#### - Recommended packages allowed, e.g., "Matrix"
6
 
6
 
7
## Method for implicit generic 'norm' (x="ANY", type="missing") -- test *before* Matrix is loaded
7
## Methods for implicit generic  'norm' (x="ANY", type="missing")
-
 
8
##                              'rcond' (x="ANY", norm="missing")
-
 
9
## tested *before* Matrix is loaded
8
setClass("zzz", slots = c(x = "NULL"))
10
setClass("zzz", slots = c(x = "NULL"))
9
setMethod("norm", c(x = "zzz", type = "character"), function (x, type, ...) "ok")
11
setMethod( "norm", c(x = "zzz", type = "character"),
-
 
12
          function (x, type, ...) type)
-
 
13
setMethod("rcond", c(x = "zzz", norm = "character"),
-
 
14
          function (x, norm, ...) norm)
10
m1 <- getMethod("norm", c(x = "ANY", type = "missing"))
15
m4 <- list(getMethod( "norm", c(x = "ANY", type = "missing")),
-
 
16
           getMethod("rcond", c(x = "ANY", norm = "missing")), # was Error .... : no method found ....
11
m2 <- selectMethod("norm", c(x = "zzz", type = "missing"))
17
           selectMethod( "norm", c(x = "zzz", type = "missing")),
-
 
18
           selectMethod("rcond", c(x = "zzz", norm = "missing")))
-
 
19
f4 <- lapply(m4, getDataPart)
12
x <- new("zzz")
20
x <- new("zzz")
13
stopifnot(is(m1, "MethodDefinition"),
21
stopifnot(all(vapply(m4, is, FALSE, "MethodDefinition")),
14
          is(m2, "MethodDefinition"),
22
          identical(f4[3:4], f4[1:2]),
15
          identical(getDataPart(m1), getDataPart(m2)),
23
          identical( norm(x, "O"), "O"),
-
 
24
          identical( norm(x     ), "O"), # was Error .... : invalid 'x': type "S4"
16
          identical(norm(x, "O"), "ok"),
25
          identical(rcond(x, "O"), "O"),
17
          identical(norm(x     ), "ok"), # was Error .... : invalid 'x': type "S4"
26
          identical(rcond(x     ), "O"), # was Error .... : argument "norm" is missing ....
18
          removeGeneric("norm"),
27
          removeGeneric( "norm"),
-
 
28
          removeGeneric("rcond"),
19
          removeClass("zzz"))
29
          removeClass("zzz"))
20
 
30
 
21
 
31
 
22
## PR#19080:
32
## PR#19080:
23
## getGenerics() when a generic function is defined in more than one
33
## getGenerics() when a generic function is defined in more than one