test_that("can parse simple table", { html <- minimal_html('
xyz
1EveJackson
2JohnDoe
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("strips whitespace", { html <- minimal_html('
x
x
x
x
') table <- html_table(html)[[1]] expect_equal(table$x, c("x", "x", "x")) }) test_that("can parse with colspan", { html <- minimal_html('
xyz
1
12
12
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can parse with rowspan", { html <- minimal_html('
xyz
123
23
3
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle wobbling rowspan", { html <- minimal_html('
xyz
1a1b1c
2b
3a3c
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle trailing rowspans", { html <- minimal_html('
xyz
1 2 3
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle blank colspans", { html <- minimal_html('
xy
1 2
3
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle blank rowspans", { html <- minimal_html('
xy
1 2
3
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle empty row", { html <- minimal_html('
x
2
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("defaults to minimal name repair", { html <- minimal_html('
xx
') table <- html_table(html)[[1]] expect_named(table, c("x", "x", "")) }) test_that("adds names if needed", { html <- minimal_html('
12
') table <- html_table(html)[[1]] expect_named(table, c("X1", "X2")) }) test_that("passes arguments to type.convert", { html <- minimal_html("
xy
NA1,2
") table <- html_table(html, na.strings = "")[[1]] expect_equal(table$x, "NA") table <- html_table(html, dec = ",")[[1]] expect_equal(table$y, 1.2) }) test_that("no conversion", { html <- minimal_html('
xy
001100.0
') table <- html_table(html, convert = FALSE)[[1]] expect_snapshot_output(table) }) test_that("fill = FALSE is deprecated", { html <- minimal_html('
x
1
') expect_snapshot({ . <- html_table(html, fill = FALSE) . <- html_table(html, fill = TRUE) }) }) test_that("can handle empty tables", { html <- minimal_html('
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle tables consisting of a single empty row", { html <- minimal_html('
') table <- html_table(html)[[1]] expect_snapshot_output(table) }) test_that("can handle tables consisting of only empty rows", { html <- minimal_html('
') table <- html_table(html)[[1]] expect_snapshot_output(table) })