inst/tinytest/test_draw_frame.R

test_draw_frame <- function() {

  ex <- data.frame(id = 1:3,
                   x = c(0, 1, NA),
                   res = c("not one", "one", NA),
                   stringsAsFactors = FALSE)
  f <- build_frame(
    "id", "x", "res"     |
    1L  , 0  , "not one" |
    2L  , 1  , "one"     |
    3L  , NA , NA        )
  expect_equal(ex, f)

  df <- draw_frame(ex)
  f2 <- eval(parse(text = df))
  expect_equal(ex, f2)

  invisible(NULL)
}

test_draw_frame()

Try the wrapr package in your browser

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

wrapr documentation built on Aug. 20, 2023, 1:08 a.m.