Skip to content

Commit

Permalink
remove multiple trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Apr 29, 2024
1 parent b026605 commit e2db3aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test_extract_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ sf <- system.file("examples", "text.pdf", package = "tabulapdf")
test_that("Text can be extracted from the whole document", {
txt <- extract_text(sf, encoding = "UTF-8")
txt <- gsub("[\r\n]", " ", txt)
txt <- gsub("\\s$", "", txt)
txt <- gsub("\\s+$", "", txt)
expect_identical(txt, "42 is the number from which the meaning of life, the universe, and everything can be derived. 42 is the number from which the meaning of life, the universe, and everything can be derived.")
})

test_that("'page' argument in extract_text works", {
txt <- extract_text(sf, pages = 1, encoding = "UTF-8")
txt <- gsub("[\r\n]", " ", txt)
txt <- gsub("\\s$", "", txt)
txt <- gsub("\\s+$", "", txt)
expect_identical(txt, "42 is the number from which the meaning of life, the universe, and everything can be derived.")
})

test_that("'area' argument in extract_text works", {
txt <- extract_text(sf, area = list(c(10, 15, 100, 550)), encoding = "UTF-8")
txt <- gsub("[\r\n]", " ", txt)
txt <- gsub("\\s$", "", txt)
txt <- gsub("\\s+$", "", txt)
expect_identical(txt[1], "42 is the number from which the meaning of life, the universe, and everything can be derived.")
})

test_that("'area' and 'page' arguments in extract_text work together", {
txt <- extract_text(sf, pages = 1, area = list(c(10, 15, 100, 550)), encoding = "UTF-8")
txt <- gsub("[\r\n]", " ", txt)
txt <- gsub("\\s$", "", txt)
txt <- gsub("\\s+$", "", txt)
expect_identical(txt, "42 is the number from which the meaning of life, the universe, and everything can be derived.")
})

Expand All @@ -39,7 +39,7 @@ test_that("Multiple pages with different areas can be extracted", {
), encoding = "UTF-8"
)
txt <- gsub("[\r\n]", " ", txt)
txt <- gsub("\\s$", "", txt)
txt <- gsub("\\s+$", "", txt)

expect_identical(
txt,
Expand Down

0 comments on commit e2db3aa

Please sign in to comment.