inst/tinytest/test_internals.R

setClass("A", representation = representation(slotA = "character"))
aclass <- new("A", slotA = "A")
aclass <- setSlots(aclass, slotA = "B")
expect_identical(aclass@slotA, "B")

invObj <- BiocBaseUtils:::unsafe_replaceSlots(aclass, slotA = 42)
expect_error(
    methods::validObject(invObj)
)
expect_error(
    setSlots(aclass, slotA = 42)
)
Bioconductor/BiocDevelUtils documentation built on Oct. 29, 2024, 10:48 p.m.