Skip to contents

[Stable]

Usage

check_format(x, len = NULL, min.len = NULL, max.len = NULL)

assert_format(
  x,
  len = NULL,
  min.len = NULL,
  max.len = NULL,
  .var.name = checkmate::vname(x),
  add = NULL
)

test_format(x, len = NULL, min.len = NULL, max.len = NULL)

expect_format(
  x,
  len = NULL,
  min.len = NULL,
  max.len = NULL,
  info = NULL,
  label = vname(x)
)

Arguments

x

[any]
Object to check.

len

[integer(1)]
Exact expected length of x.

min.len

[integer(1)]
Minimal length of x.

max.len

[integer(1)]
Maximal length of x.

.var.name

[character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.

add

[AssertCollection]
Collection to store assertion messages. See AssertCollection.

info

[character(1)]
Extra information to be included in the message for the testthat reporter. See expect_that.

label

[character(1)]
Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.

Value

TRUE if successful, otherwise a string with the error message.

See also

assertions for more details.

Examples

check_format("%5.2f")
#> [1] TRUE