From b5a8462613a940ee3d97981057025f6229e27e3d Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 27 Jun 2024 08:16:11 -0500 Subject: [PATCH] More test polishing --- tests/testthat/test-parse.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-parse.R b/tests/testthat/test-parse.R index 77d4ea6..7d58183 100644 --- a/tests/testthat/test-parse.R +++ b/tests/testthat/test-parse.R @@ -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 -----------------------------------------------------------