Skip to content

Commit cc48b7b

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-live-test-fail
# Conflicts: # R/java_env.R # tests/testthat/test-java_env_subprocess_regression.R
2 parents e9ecbfd + a6bd250 commit cc48b7b

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

R/java_env.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,19 +352,16 @@ java_check_version_rjava <- function(
352352
}
353353
}
354354
}
355-
356355
java_version_check_fn <- getFromNamespace(
357356
"java_version_check_rscript",
358357
"rJavaEnv"
359358
)
360-
361359
deparse_collapse <- function(x) {
362360
paste(deparse(x, width.cutoff = 500), collapse = "\n")
363361
}
364362

365363
java_version_check_body <- deparse_collapse(body(java_version_check_fn))
366364
libs_val <- deparse_collapse(as.character(.libPaths()))
367-
368365
wrapper_script <- paste0(
369366
".libPaths(",
370367
libs_val,

tests/testthat/test-java_env_subprocess_regression.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ test_that("._java_version_check_rjava_impl_original prefers callr", {
1010
captured_libpath <<- libpath
1111
list(
1212
java_version = "21.0.8",
13-
output = "rJava and other rJava/Java-based packages will use Java version: \"21.0.8\""
13+
output = paste0(
14+
"rJava and other rJava/Java-based packages will use ",
15+
"Java version: \"21.0.8\""
16+
)
1417
)
1518
},
1619
.package = "callr"
@@ -62,7 +65,9 @@ test_that("._java_version_check_rjava_impl_original falls back to Rscript", {
6265
if (file.exists(args[1])) {
6366
captured_script <<- readLines(args[1])
6467
}
65-
"rJava and other rJava/Java-based packages will use Java version: \"21.0.8\""
68+
c(
69+
"rJava and other rJava/Java-based packages will use Java version: \"21\""
70+
)
6671
},
6772
.package = "base"
6873
)
@@ -73,10 +78,10 @@ test_that("._java_version_check_rjava_impl_original falls back to Rscript", {
7378

7479
expect_equal(result$major_version, "21")
7580
expect_equal(captured_env[["JAVA_HOME"]], "/mock/java")
76-
expect_false(any(grepl("get_libjvm_path <- function", captured_script)))
7781
expect_equal(sum(grepl("java_version_check <- function", captured_script)), 1)
7882

7983
script_text <- paste(captured_script, collapse = "\n")
8084
expect_true(grepl("\\.libPaths\\(c\\(", script_text))
8185
expect_true(grepl("/home/user/R/x86_64-pc-linux-gnu-library/4.5", script_text))
86+
expect_false(any(grepl("get_libjvm_path <- function", captured_script)))
8287
})

0 commit comments

Comments
 (0)