Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unused code since we require R 4.0.0 #130

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions R/parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ parse_all <- function(x, filename = NULL, allow_error = FALSE) UseMethod("parse_

#' @export
parse_all.character <- function(x, filename = NULL, allow_error = FALSE) {

# Do not convert strings to factors by default in data.frame()
op <- options(stringsAsFactors = FALSE)
on.exit(options(op), add = TRUE)

if (length(grep("\n", x))) {
# strsplit('a\n', '\n') needs to return c('a', '') instead of c('a')
x <- gsub("\n$", "\n\n", x)
Expand Down Expand Up @@ -114,18 +109,6 @@ append_break <- function(x) {
if (n <= 1) x else paste(x, rep(c("\n", ""), c(n - 1, 1)), sep = "")
}

# YX: This hack is because srcfilecopy() uses grepl("\n", fixed = TRUE), which
# does not work when the source lines contain multibyte characters that are not
# representable in the current locale on Windows (see
# https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16264). In our case, we
# have already split the lines by \n, so there is no need to do that again like
# srcfilecopy() does internally.
if (getRversion() <= '3.2.2') srcfilecopy <- function(filename, lines, ...) {
src <- base::srcfilecopy(filename, lines = "", ...)
src$lines <- lines
src
}

#' @export
parse_all.connection <- function(x, filename = NULL, ...) {
if (!isOpen(x, "r")) {
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ test_that("traceback useful if stop_on_error == 2L", {
})

test_that("capture messages in try() (#88)", {
skip_if(getRversion() < "3.4")

ev <- evaluate(file("try.R"))
expect_match(ev[[length(ev)]], "Obscure error")
})
Loading