Check if an argument is an R6 class
Usage
checkR6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE
)
check_r6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE
)
assertR6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
assert_r6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
testR6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE
)
test_r6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE
)
expect_r6(
x,
classes = NULL,
ordered = FALSE,
cloneable = NULL,
public = NULL,
private = NULL,
null.ok = FALSE,
info = NULL,
label = vname(x)
)Arguments
- x
[
any]
Object to check.- classes
[
character]
Class names to check for inheritance withinherits.xmust inherit from all specified classes.- ordered
[
logical(1)]
Expectxto be specialized in provided order. Default isFALSE.- cloneable
[
logical(1)]
IfTRUE, check thatxhas aclonemethod. IfFALSE, ensure thatxis not cloneable.- public
[
character]
Names of expected public slots. This includes active bindings.- private
[
character]
Names of expected private slots.- null.ok
[
logical(1)]
If set toTRUE,xmay also beNULL. In this case only a type check ofxis performed, all additional checks are disabled.- .var.name
[
character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented invname.- add
[
AssertCollection]
Collection to store assertion messages. SeeAssertCollection.- info
[
character(1)]
Extra information to be included in the message for the testthat reporter. Seeexpect_that.- label
[
character(1)]
Name of the checked object to print in messages. Defaults to the heuristic implemented invname.
Value
Depending on the function prefix:
If the check is successful, the functions
assertClass/assert_class return
x invisibly, whereas
checkClass/check_class and
testClass/test_class return
TRUE.
If the check is not successful,
assertClass/assert_class
throws an error message,
testClass/test_class
returns FALSE,
and checkClass/check_class
return a string with the error message.
The function expect_class always returns an
expectation.
See also
Other classes:
checkClass(),
checkMultiClass()