tests/testthat/test-txtMergeLines.R

library(testthat)
context("Test txtMergeLines")

test_that("Check one argument with multiple new lines",{
  out <- txtMergeLines("a
                       b")
  expect_equal(length(gregexpr("<br>", out)[[1]]),
               1)

  out <- txtMergeLines("a
                       b
                       c")
  expect_equal(length(gregexpr("<br>", out)[[1]]),
               2)
})

test_that("Check multiple arguments",{
  out <- txtMergeLines("a", "b")
  expect_equal(length(gregexpr("<br>", out)[[1]]),
               1)

  out <- txtMergeLines("a", "b", "c")
  expect_equal(length(gregexpr("<br>", out)[[1]]),
               2)
})

Try the htmlTable package in your browser

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

htmlTable documentation built on Nov. 2, 2023, 6:26 p.m.