Skip to contents

assert_not_empty() checks that an output field has at least one character that is not white space.

Usage

assert_not_empty(field = NULL, type = c("assert", "suggest"))

Arguments

field

The output field to check. With NULL, the whole output is checked, which suits outputs with a single field. A missing field fails the check.

type

"assert" (the default) for a hard assertion, which makes with_assertions() retry when it fails, or "suggest" for a soft one, which only gives a warning.

Value

An assertion for assertion_set() or with_assertions().

Examples

assert_not_empty("answer")
#> 
#> ── Hard Assertion 
#> • Field: any field
#> • Message: "answer must not be empty"