Skip to content

Commit

Permalink
White space stripping for string command. Fix #161
Browse files Browse the repository at this point in the history
  • Loading branch information
Non-Contradiction committed Mar 5, 2021
1 parent 2774ae5 commit c5967c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inst/julia/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})

0 comments on commit c5967c1

Please sign in to comment.