Skip to content

Commit a6ae672

Browse files
Filip Schouwenaarseddelbuettel
authored andcommitted
Resolve segfault when running embeddedR test (#869)
1 parent 1b33aad commit a6ae672

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inst/unitTests/runit.embeddedR.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# You should have received a copy of the GNU General Public License
1919
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
2020

21-
.runThisTest <- FALSE #Sys.getenv("RunAllRcppTests") == "yes"
21+
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
2222

2323
if (.runThisTest) {
2424

@@ -27,13 +27,13 @@ if (.runThisTest) {
2727
expectedVars <- c("foo", "x")
2828

2929
# embeddedR.cpp exposes the function foo, R snippet calls foo
30-
newEnv <- new.env()
30+
newEnv <- new.env(parent = baseenv())
3131
Rcpp::sourceCpp(file.path(path, "embeddedR.cpp"),
3232
env = newEnv)
3333
checkEquals(ls(newEnv), expectedVars, msg = " sourcing code in custom env")
3434

3535
# R snippet in embeddedR2.cpp also contains a call to foo from previous cpp
36-
newEnv2 <- new.env()
36+
newEnv2 <- new.env(parent = baseenv())
3737
checkException(Rcpp::sourceCpp(file.path(path, "embeddedR2.cpp"), env = newEnv2),
3838
" not available in other env")
3939
}

0 commit comments

Comments
 (0)