The R Project SVN R

Rev

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

Rev 84105 Rev 84107
Line 198... Line 198...
198
+ }
198
+ }
199
> 
199
> 
200
> p <- new("Person", name = "Who", age = -1)
200
> p <- new("Person", name = "Who", age = -1)
201
> stopifnot(p@name == "Who")
201
> stopifnot(p@name == "Who")
202
> 
202
> 
-
 
203
> 
-
 
204
> ## Some tests for `chooseOpsMethod()`, called from C DispatchGroup() when
-
 
205
> ## 2 methods are found
-
 
206
> foo_obj <- structure(1, class = "foo")
-
 
207
> bar_obj <- structure(1, class = "bar")
-
 
208
> 
-
 
209
> `+.foo` <- function(e1, e2) "foo"
-
 
210
> `+.bar` <- function(e1, e2) "bar"
-
 
211
> 
-
 
212
> invisible(foo_obj + bar_obj)  # Warning: Incompatible methods
-
 
213
Warning message:
-
 
214
Incompatible methods ("+.foo", "+.bar") for "+" 
-
 
215
> 
-
 
216
> chooseOpsMethod.bar <- function(x, y, mx, my, cl, reverse) TRUE
-
 
217
> 
-
 
218
> stopifnot(exprs = {
-
 
219
+     identical(foo_obj + bar_obj, "bar")
-
 
220
+     identical(bar_obj + foo_obj, "bar")
-
 
221
+ })
-
 
222
>