tests/testthat/test-cat_line.R

test_that("cat_line prints text followed by a newline", {
  expect_identical(
    capture.output(cat_line("Hello")),
    "Hello"
  )
})


test_that("cat_line concatenates arguments without separators", {
  expect_identical(
    capture.output(cat_line("Survey ", 1, ": ", "OK")),
    "Survey 1: OK"
  )
})


test_that("cat_line handles empty input", {
  expect_identical(
    capture.output(cat_line()),
    ""
  )
})


test_that("cat_line handles vector input", {
  expect_identical(
    capture.output(cat_line(c("First", "Second"))),
    c("First", "Second")
  )
})


test_that("cat_line invisibly returns NULL", {
  capture.output(result <- withVisible(cat_line("Hello")))

  expect_null(result$value)
  expect_false(result$visible)
})

Try the retroharmonize package in your browser

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

retroharmonize documentation built on Nov. 29, 2026, 5:06 p.m.