File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed
Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2+ //
3+ // Environment.cpp: Rcpp R/C++ interface class library -- Environment unit tests
4+ //
5+ // Copyright (C) 2018 Dirk Eddelbuettel and Romain Francois
6+ //
7+ // This file is part of Rcpp.
8+ //
9+ // Rcpp is free software: you can redistribute it and/or modify it
10+ // under the terms of the GNU General Public License as published by
11+ // the Free Software Foundation, either version 2 of the License, or
12+ // (at your option) any later version.
13+ //
14+ // Rcpp is distributed in the hope that it will be useful, but
15+ // WITHOUT ANY WARRANTY; without even the implied warranty of
16+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ // GNU General Public License for more details.
18+ //
19+ // You should have received a copy of the GNU General Public License
20+ // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+ #include < Rcpp.h>
23+ using namespace Rcpp ;
24+
25+ // [[Rcpp::export]]
26+ int foo (){
27+ return 42 ;
28+ }
29+
30+ /* ** R
31+ x <- foo()
32+ x
33+ */
Original file line number Diff line number Diff line change 1+ # !/usr/bin/env r
2+ # -*- mode: R; ess-indent-level: 4; tab-width: 4; indent-tabs-mode: nil; -*
3+ #
4+ # Copyright (C) 2012 - 2016 Dirk Eddelbuettel and Romain Francois
5+ #
6+ # This file is part of Rcpp.
7+ #
8+ # Rcpp is free software: you can redistribute it and/or modify it
9+ # under the terms of the GNU General Public License as published by
10+ # the Free Software Foundation, either version 2 of the License, or
11+ # (at your option) any later version.
12+ #
13+ # Rcpp is distributed in the hope that it will be useful, but
14+ # WITHOUT ANY WARRANTY; without even the implied warranty of
15+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ # GNU General Public License for more details.
17+ #
18+ # You should have received a copy of the GNU General Public License
19+ # along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
20+
21+ .runThisTest <- TRUE # Sys.getenv("RunAllRcppTests") == "yes"
22+
23+ if (.runThisTest ) {
24+
25+ test.embeddedR <- function () {
26+
27+ path <- system.file(" unitTests" , package = " Rcpp" )
28+ expectedVars <- c(" foo" , " x" )
29+ newEnv <- new.env()
30+ Rcpp :: sourceCpp(file.path(path , " cpp" , " embeddedR.cpp" ), env = newEnv )
31+ checkEquals(ls(newEnv ), expectedVars , msg = " sourcing code in other env" )
32+ }
33+
34+ }
35+
36+
37+
You can’t perform that action at this time.
0 commit comments