ttdo_boolean_and_message_tests: Extensions of boolean and messaging tests from tinytest

ttdo_boolean_and_message_testsR Documentation

Extensions of boolean and messaging tests from tinytest

Description

Building on the tinytest functions for testing boolean values with additional test feedback through attributes.

Usage

expect_true_xl(current, info = NA_character_, ...)

expect_false_xl(current, info = NA_character_, ...)

expect_null_xl(current, info = NA_character_, ...)

expect_silent_xl(current, quiet = TRUE, info = NA_character_, ...)

expect_error_xl(
  current,
  pattern = ".*",
  class = "error",
  info = NA_character_,
  ...
)

expect_warning_xl(
  current,
  pattern = ".*",
  class = "warning",
  info = NA_character_,
  strict = FALSE,
  ...
)

expect_message_xl(
  current,
  pattern = ".*",
  class = "message",
  info = NA_character_,
  strict = FALSE,
  ...
)

Arguments

current

[R object or expression] Outcome or expression under scrutiny.

info

scalar. Optional user-defined message. Must be a single character string. Multiline comments may be separated by "\n".

...

Passed to all.equal and returned as a test attribute

quiet

[logical] suppress output printed by the current expression (see examples)

pattern

[character] A regular expression to match the message.

class

[character] For condition signals (error, warning, message) the class from which the condition should inherit.

strict

[logical] scalar. If set to TRUE, any exception worse than the wanted exception will cause the test to fail.

Details

While tinytest does now support the passing of additional information with the info field in its tests, they are not yet supported in the as.data.frame.tinytests method.

Value

A tinytest object. A tinytest object is a logical with attributes holding information about the test that was run

Examples

library(tinytest)
using(ttdo)
expect_true_xl(TRUE, score = 3) # TRUE
expect_true_xl(FALSE, name = "check 1-1==2", score = 1, totalpts = 2) # FALSE


ttdo documentation built on March 7, 2023, 5:27 p.m.