tests/testthat/test-replay-html.R

context("test-replay-html.R")

# Output labelling --------------------------------------------------------

test_that("prompt added to start of each line", {
  expect_equal(label_lines("a\nb\n\n", prompt = "#"), c("#a", "#b", "#"))
})

test_that("prompt is escaped", {
  expect_equal(label_lines("\n", prompt = ">"), ">")
})

test_that("input is escaped", {
  expect_equal(label_lines(">", prompt = ""), ">")
})

test_that("class generates line-by-line span", {
  expect_equal(
    label_lines("a\nb", "X", prompt = ""),
    c("<span class='X'>a</span>", "<span class='X'>b</span>")
  )
})
hadley/pkgdown documentation built on Oct. 22, 2018, 4:44 a.m.