Skip to content

Commit

Permalink
Fix failing test on R-devel (#2528)
Browse files Browse the repository at this point in the history
* to kick off CI/CD

* fix failing test

* Test robust across R versions

* with_content_to_parse doesn't get parent env variables?

* revert changes to cran comments

* better test

* useBytes=TRUE

---------

Co-authored-by: Michael Chirico <[email protected]>
  • Loading branch information
IndrajeetPatil and MichaelChirico committed Mar 21, 2024
1 parent 2a78fed commit f351dfd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/testthat/test-get_source_expressions.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ test_that("Multi-byte character truncated by parser is ignored", {
skip_if_not_utf8_locale()
# \U2013 is the Unicode character 'en dash', which is
# almost identical to a minus sign in monospaced fonts.
with_content_to_parse("y <- x \U2013 42", {
expect_identical(error$message, "unexpected input")
content <- "y <- x \U2013 42"
# message is like '<text>:1:8: unexpected invalid token\n1: ...'
with_content_to_parse(content, {
base_msg <- conditionMessage(tryCatch(str2lang(content), error = identity))
# Just ensure that the captured message is a substring of the parser error, #2527
expect_true(grepl(error$message, base_msg, fixed = TRUE, useBytes = TRUE))
expect_identical(error$column_number, 8L)
})
})
Expand Down

0 comments on commit f351dfd

Please sign in to comment.