tests/testthat/test-para_conc.R

test_that("para_conc() works and generating messages", {
  expect_output(str(para_conc(sci_en, sci_id, pattern = "should")), "tbl_df")
})
unlink("parallel_conc.txt")

my_para_conc_eng <- para_conc(sci_en, sci_id, pattern = "should", conc_sample = FALSE)
test_that("para_conc() works and generating messages", {
  expect_output(str(my_para_conc_eng), "tbl_df")
  expect_match(unique(my_para_conc_eng$NODE), "should")
})
unlink("parallel_conc.txt")

my_para_conc <- para_conc(sci_id, sci_en, pattern = "\\bseharusnya\\b", conc_sample = FALSE, filename = FALSE)
test_that("para_conc() works when the source and target texts are switched", {
  expect_output(str(my_para_conc), "tbl_df")
  expect_match(unique(my_para_conc$NODE), "seharusnya")
})
unlink("parallel_conc.txt")

test_that("para_conc() works and generating messages", {
  expect_message(str(para_conc(sci_en, sci_id, pattern = "sadfkadfjds;fld;saf", conc_sample = FALSE)), "(?i)(no) match([(]es[)])? found")
})
unlink("parallel_conc.txt")

test_that("the codes for checking the number of samples and matches work", {
  expect_message(para_conc(sci_en, sci_id, pattern = "should", conc_sample = 64), "equal to")
  expect_message(para_conc(sci_en, sci_id, pattern = "should", conc_sample = 65), "greater than")
})
gederajeg/paracorp documentation built on Jan. 2, 2022, 4:33 a.m.