From c5967c1684b5b77ccb8ae792c6d8815450b4a47e Mon Sep 17 00:00:00 2001 From: lch34677 Date: Fri, 5 Mar 2021 11:32:45 -0500 Subject: [PATCH] White space stripping for string command. Fix #161 --- inst/julia/setup.jl | 2 +- tests/testthat/test_basic.R | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/inst/julia/setup.jl b/inst/julia/setup.jl index b8938a5..7a2d3e2 100644 --- a/inst/julia/setup.jl +++ b/inst/julia/setup.jl @@ -200,7 +200,7 @@ function exists(x) end function eval_string(x) - Core.eval(Main, parse(x)) + Core.eval(Main, parse(strip(x))) end function installed_package(pkg_name) diff --git a/tests/testthat/test_basic.R b/tests/testthat/test_basic.R index cccd68b..50714eb 100644 --- a/tests/testthat/test_basic.R +++ b/tests/testthat/test_basic.R @@ -17,3 +17,12 @@ test_that("test of the basic functionality", { expect_equal(julia_call("sqrt.", c(1:10)), sqrt(c(1:10))) expect_equal(julia_call("log.", c(1:10)), log(c(1:10))) }) + +test_that("test of white space stripping for string command", { + skip_on_cran() + julia <- julia_setup(installJulia = TRUE) + + expect_equal({julia_command("b = sqrt(2) + "); julia_eval("b + ")}, sqrt(2)) +})