tests/testthat/helpers.R

skip_if_interactive <- function() {
  testthat::skip_if(interactive())
}

skip_if_http_error <- function() {
  formatted_text <- stringr::str_replace_all("hello", " ", "%20")

  formatted_link <- paste0(
    "https://translate.google.com/m?tl=",
    "es", "&sl=", "en",
    "&q=",
    formatted_text
  )
  testthat::skip_if(httr::http_error(httr::GET(formatted_link)))
}

Try the polyglotr package in your browser

Any scripts or data that you put into this service are public.

polyglotr documentation built on Sept. 11, 2024, 6:35 p.m.