tests/testthat/test-make_column.R

test_that("resolve_col_type() passes `ctype` other than 'COL_GUESS' through", {
  expect_identical(resolve_col_type("a cell", "COL_ANYTHING"), "COL_ANYTHING")
})

test_that("resolve_col_type() implements coercion DAG for 'COL_GUESS'", {
  input <- c("l", "D")
  expect_identical(resolve_col_type(input, "COL_GUESS"), "COL_LIST")
})

test_that("blank cell doesn't trick resolve_col_type() into guessing COL_LIST", {
  input <- list(
    structure(1, class = c("CELL_BLANK", "SHEETS_CELL")),
    structure(1, class = c("CELL_TEXT", "SHEETS_CELL"))
  )
  expect_identical(resolve_col_type(input, "COL_GUESS"), "CELL_TEXT")
})

Try the googlesheets4 package in your browser

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

googlesheets4 documentation built on July 9, 2023, 7:40 p.m.