tests/testthat/test-utils.R

test_that("can truncate strings", {
  expect_equal(str_trunc("abcdef", 10), "abcdef")
  expect_equal(str_trunc("abcdef", 4), "a...")
})

test_that("minimal html doesn't change unexpectedly", {
  expect_snapshot(cat(as.character(minimal_html("<p>Hi"))))
})

Try the rvest package in your browser

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

rvest documentation built on June 22, 2024, 10:47 a.m.