tests/testthat/test-encoding.R

context("encoding")

test_that("Encoding is retained", {
  strings <- c(
    "Zürich",
    "北京填鴨们",
    "ผัดไทย",
    "寿司",
    rawToChar(as.raw(1:40)),
    "?foo&bar=baz!bla\n"
  )
  encstr <- curl::curl_escape(strings)
  data <- paste(encstr, encstr, collapse = "&", sep = "=")
  out <- webutils::parse_query(data)
  expect_equal(names(out), strings)
  expect_equal(unlist(unname(out)), strings)
})

Try the webutils package in your browser

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

webutils documentation built on April 29, 2020, 1:05 a.m.