tests/testthat/test-inShell.R

test_that("inShell", {
  expect_equal(inShell({ print(x) }),
               c("$(R) -e '{' \\",
                 "-e '    print(x)' \\",
                 "-e '}'"))
  expect_equal(inShell({
                   x <- 1
                   print(x)
               }),
               c("$(R) -e '{' \\",
                 "-e '    x <- 1' \\",
                 "-e '    print(x)' \\",
                 "-e '}'"))
})

Try the rmake package in your browser

Any scripts or data that you put into this service are public.

rmake documentation built on Nov. 12, 2025, 9:06 a.m.