Description Usage Arguments Examples
Stubbing a function in a package can only be done in the context of some expression (a block of code). Otherwise, dangerous things could happen! (We are actually replacing the function in the package's namespace.)
1 | package_stub(package_name, function_name, stubbed_value, expr)
|
package_name |
character. The name of the package to look in. |
function_name |
character. The name of the function to stub. |
stubbed_value |
function. The function to temporarily replace this function with. |
expr |
expression. An expression to evaluate with the stubbed changes. The stubbing will be reverted after this expression is executed. |
1 | package_stub("methods", "new", function(...) 'test', stopifnot(new('example') == 'test'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.