Check that typeof(current) is type
expect_type(current, type, ..., info = NA_character_)[R object or expression] Object or expression to be tested
[character(1L)] Expected base type (as given by
typeof())
Ignored
[character(1L)] Optional user-defined message; must be a
single string value
A tinytest object. A tinytest object is a
logical with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_type()
Other typing expectation predicates:
expect_s3_class(),
expect_s4_class()
expect_type(1L, "integer") # Pass
#> ----- PASSED : <-->
#> call| expect_type(1, "integer")
expect_type(1.0, "integer") # Fail
#> ----- FAILED[attr]: <-->
#> call| expect_type(1, "integer")
#> diff| Expected object of type 'integer', got 'double'