From e2db3aa40f68e7718671342e0422a2374dd71190 Mon Sep 17 00:00:00 2001 From: Mauricio 'Pacha' Vargas Sepulveda Date: Mon, 29 Apr 2024 11:39:24 -0400 Subject: [PATCH] remove multiple trailing spaces --- tests/testthat/test_extract_text.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test_extract_text.R b/tests/testthat/test_extract_text.R index e3dd306..aa566cf 100644 --- a/tests/testthat/test_extract_text.R +++ b/tests/testthat/test_extract_text.R @@ -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.") }) @@ -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,