dwww Home | Show directory contents | Find package

context("IDN")

test_that("IDN domain names",{
  # OSX does not support IDN by default :(
  skip("IDN tests fail on autopkgtest infrastructure")
  skip_on_cran()

  koln <- "http://www.köln.de"
  expect_is(curl::curl_fetch_memory(enc2utf8(koln))$status_code, "integer")
  expect_is(curl::curl_fetch_memory(enc2native(koln))$status_code, "integer")

  con <- curl::curl(enc2utf8(koln))
  expect_is(readLines(con, warn = FALSE), "character")
  close(con)

  con <- curl::curl(enc2native(koln))
  expect_is(readLines(con, warn = FALSE), "character")
  close(con)

  kremlin <- "http://\u043F\u0440\u0435\u0437\u0438\u0434\u0435\u043D\u0442.\u0440\u0444"
  expect_is(curl::curl_fetch_memory(kremlin)$status_code, "integer")

  con <- curl::curl(kremlin)
  expect_is(readLines(con, warn = FALSE), "character")
  close(con)

  # Something random that doesn't exist
  wrong <- "http://\u043F\u0440\u00F6\u0437\u0438\u0434\u0435\u043D\u0442.\u0440\u0444"
  expect_error(curl::curl_fetch_memory(enc2utf8(wrong)), 'resolve')
})

Generated by dwww version 1.15 on Wed Jun 26 01:03:37 CEST 2024.