expect_not_null: Extend testthat expectation for not null

Description Usage Arguments Examples

View source: R/utils-testthat-helpers.R

Description

This is an expectation as a counterpart of testthat::expect_null().

Usage

1
expect_not_null(object, info = NULL, label = NULL)

Arguments

object

Object to test.

info

Extra information to be included in the message. This argument is soft-deprecated and should not be used in new code. Instead see alternatives in testthat::quasi_label().

label

Used to customize failure messages. For expert use only.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

x <- NULL
y <- 10

expect_not_null(y)

testthat::show_failure(expect_not_null(x))

## End(Not run)

chriszheng2016/zstmodelr documentation built on June 13, 2021, 8:59 p.m.