ttm_expect_no_error: Test that multi: expect no error

View source: R/expect_no_error.R

ttm_expect_no_errorR Documentation

Test that multi: expect no error

Description

See 'testthat::expect_no_error' for details.

Usage

ttm_expect_no_error(object, message = NULL, class = NULL, verbose = 0)

Arguments

object

Object to test.

message

Passed to 'testthat::expect_no_error()'.

class

Passed to 'testthat::expect_no_error()'.

verbose

Amount of info that should be printed.

Value

Test result

Examples

set.seed(0)

# 1 attempt, all pass
ttm(1, {
  ttm_expect_no_error(1)
})

# Fails first ~10 times, then passes
ttm(100, {
  ttm_expect_no_error({
    if (runif(1) > 0.1) {
      print(1)
      stop('give error')
    }
  })
})

# Will always fail regardless of number of attempts
try({
  ttm(3, {
    ttm_expect_no_error(stop('error'))
  })
})

testthatmulti documentation built on Aug. 25, 2025, 1:10 a.m.