tests/testthat/test-tune.R

test_that("tune creates a call", {
  expect_true(is.call(tune()))
  expect_true(is.call(tune("foo")))
})

test_that("tune `id` value", {
  expect_identical(tune(), call("tune"))
  expect_identical(tune(""), call("tune"))
  expect_identical(tune("foo"), call("tune", "foo"))
})

test_that("`id` is validated", {
  expect_snapshot(error = TRUE, tune(1))
  expect_snapshot(error = TRUE, tune(c("x", "y")))
  expect_snapshot(error = TRUE, tune(NA_character_))
})

Try the hardhat package in your browser

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

hardhat documentation built on April 4, 2025, 3:18 a.m.