We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d005106 commit 2fe2a46Copy full SHA for 2fe2a46
tests/testthat/test-encoding.R
@@ -0,0 +1,23 @@
1
+context("non-ASCII characters are handled properly")
2
+
3
+test_that("non-ASCII characters are handled properly", {
4
+ # c.f. rlang::mut_latin1_locale()
5
+ locale <- if (.Platform$OS.type == "windows") "English_United States.1252" else "en_US.ISO8859-1"
6
7
+ withr::with_locale(
8
+ c(LC_CTYPE = locale),
9
+ {
10
+ # c.f. dplyr's tests/testthat/helper-encoding.R
11
+ latin_string <- "Gl\u00fcck+1"
12
13
+ tmp <- tempfile(fileext = ".R")
14
+ con <- file(tmp, encoding = "UTF-8")
15
+ on.exit(close(con), add = TRUE)
16
17
+ writeLines(latin_string, con)
18
+ style_file(tmp)
19
+ result <- readLines(con)
20
+ expect_equal(result, latin_string)
21
+ }
22
+ )
23
+})
0 commit comments