test_that("counts correct number of fields based on supplied tokenizer", {
string <- "1,a,NA\n2,b,NA\n"
res_csv <- count_fields(string, tokenizer_csv())
res_tsv <- count_fields(string, tokenizer_tsv())
expect_equal(res_csv, c(3, 3))
expect_equal(res_tsv, c(1, 1))
})
test_that("maximum lines counted is respected", {
string <- "1,a,NA\n2,b,NA\n"
res_csv <- count_fields(string, tokenizer_csv(), n_max = 1)
expect_equal(res_csv, 3)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.