Skip to content

Commit

Permalink
More test polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jun 27, 2024
1 parent 178bcea commit b5a8462
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/testthat/test-parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ test_that("parse(allow_error = TRUE/FALSE)", {
test_that("double quotes in Chinese characters not destroyed", {
skip_if_not(l10n_info()[['UTF-8']])

expect_identical(parse_all(c('1+1', '"你好"'))[2, 1], '"你好"')
out <- parse_all(c('1+1', '"你好"'))
expect_equal(out$src[[2]], '"你好"')
expect_equal(out$expr[[2]], expression("你好"), ignore_attr = "srcref")
})

test_that("multibyte characters are parsed correct", {
test_that("multibyte characters are parsed correctly", {
skip_if_not(l10n_info()[['UTF-8']])

code <- c("ϱ <- 1# g / ml", "äöüßÄÖÜπ <- 7 + 3# nonsense")
expect_identical(parse_all(code)$src, append_break(code))
out <- parse_all(code)
expect_equal(out$src, paste0(code, c("\n", "")))
})

# find_function_body -----------------------------------------------------------
Expand Down

0 comments on commit b5a8462

Please sign in to comment.