Skip to content

Commit 02e9b24

Browse files
committed
add assertions
1 parent 6717bb0 commit 02e9b24

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

R/chevron_tlg-S4methods.R

+4
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ setMethod(
279279
f = "main<-",
280280
signature = "chevron_tlg",
281281
definition = function(x, value) {
282+
checkmate::assert_function(value)
282283
x@main <- value
283284
validObject(x)
284285
x
@@ -324,6 +325,7 @@ setMethod(
324325
f = "preprocess<-",
325326
signature = "chevron_tlg",
326327
definition = function(x, value) {
328+
checkmate::assert_function(value)
327329
x@preprocess <- value
328330
validObject(x)
329331
x
@@ -368,6 +370,7 @@ setMethod(
368370
f = "postprocess<-",
369371
signature = "chevron_tlg",
370372
definition = function(x, value) {
373+
checkmate::assert_function(value)
371374
x@postprocess <- value
372375
validObject(x)
373376
x
@@ -412,6 +415,7 @@ setMethod(
412415
f = "dataset<-",
413416
signature = "chevron_tlg",
414417
definition = function(x, value) {
418+
checkmate::assert_character(value, null.ok = TRUE)
415419
x@dataset <- value
416420
validObject(x)
417421
x

tests/testthat/test-chevron_tlg-methods.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ test_that("dataset setter works as expected", {
275275
test_that("dataset sends an error as expected", {
276276
skip_on_os("windows")
277277
obj <- aet01
278-
expect_error(dataset(obj) <- 1, "assignment of an object of class “numeric” is not valid for @‘dataset’",
278+
expect_error(dataset(obj) <- 1, "Must be of type 'character' (or 'NULL')",
279279
fixed = TRUE
280280
)
281281
})

0 commit comments

Comments
 (0)