test_that("dictionary regression tests", {
sanitise <- function(x) {
gsub(" </p>", "</p>", x, fixed = TRUE)
}
test_dict <- function(old, languages, ignore = character()) {
filter <- function(df, ignore) {
df[!df$key %in% ignore, ]
}
old_1 <- local({
env <- new.env()
load(system.file(old, package = "mpt", mustWork = TRUE),
envir = env)
filter(as.data.frame(env$mpt_dict), ignore)
})
current <- filter(as.data.frame(mpt::mpt_dict), ignore)
for (l in tolower(c("key", languages))) {
names(old_1) <- tolower(old_1)
names(current) <- tolower(current)
expect_equal(sanitise(old_1[[l]]),
sanitise((current[[l]])))
}
}
test_dict("regression-tests/dictionaries/dict-may-2019.rda",
c("DE", "EN", "FR", "RU"),
ignore = c("AMPT_0004_I_0001_1", "demo_intro", "click_here_to_play"))
test_dict("regression-tests/dictionaries/dict-nov-2019.rda",
c("DE", "EN", "FR", "RU", "DA"))
test_dict("regression-tests/dictionaries/dict-feb-2021.rda",
c("DE", "EN", "FR", "RU", "DA", "NL"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.