| 1 |
test_that("IDN domain names",{ |
| 2 |
# OSX does not support IDN by default :( |
| •3 |
skip("IDN tests fail on autopkgtest infrastructure") |
| 4 |
skip_on_cran() |
| 5 |
|
| 6 |
koln <- "http://www.köln.de" |
| 7 |
expect_is(curl::curl_fetch_memory(enc2utf8(koln))$status_code, "integer") |
| 8 |
expect_is(curl::curl_fetch_memory(enc2native(koln))$status_code, "integer") |
| 9 |
|
| 10 |
con <- curl::curl(enc2utf8(koln)) |
| 11 |
expect_is(readLines(con, warn = FALSE), "character") |
| 12 |
close(con) |
| 13 |
|
| 14 |
con <- curl::curl(enc2native(koln)) |
| 15 |
expect_is(readLines(con, warn = FALSE), "character") |
| 16 |
close(con) |
| 17 |
|
| 18 |
kremlin <- "http://\u043F\u0440\u0435\u0437\u0438\u0434\u0435\u043D\u0442.\u0440\u0444" |
| 19 |
expect_is(curl::curl_fetch_memory(kremlin)$status_code, "integer") |
| 20 |
|
| 21 |
con <- curl::curl(kremlin) |
| 22 |
expect_is(readLines(con, warn = FALSE), "character") |
| 23 |
close(con) |
| 24 |
|
| 25 |
# Something random that doesn't exist |
| 26 |
wrong <- "http://\u043F\u0440\u00F6\u0437\u0438\u0434\u0435\u043D\u0442.\u0440\u0444" |
| 27 |
expect_error(curl::curl_fetch_memory(enc2utf8(wrong)), 'resolve') |
| 28 |
}) |