tests/testthat/test_hash_error.R

context("Test the error handlers for hash functions")

test_that("non-vector inputs are detected", {

  expect_that(md5(list(c("foo","bar"),"baz")), throws_error(regexp = "must be raw or character vector", fixed = TRUE))

})

test_that("non-character inputs are detected", {

  expect_that(md5(12), throws_error(regexp = "must be raw or character vector", fixed = TRUE))

})

Try the openssl package in your browser

Any scripts or data that you put into this service are public.

openssl documentation built on Sept. 26, 2023, 1:09 a.m.