Skip to content

Commit a7bf066

Browse files
committed
streamlined initial test and sourceCpp
1 parent b5f81b1 commit a7bf066

File tree

8 files changed

+15
-33
lines changed

8 files changed

+15
-33
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* inst/tinytest/test_rcpp_package_skeleton.R: Idem
1010
* inst/tinytest/test_reference.R: Idem
1111

12+
* inst/tinytest/test_*.R: Streamlined initial test and sourceCpp call
13+
1214
* src/attributes.cpp: Remove dangling '#nocov end'
1315

1416
2019-12-07 Dirk Eddelbuettel <[email protected]>

inst/tinytest/test_date.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_date.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/dates.cpp")
21+
Rcpp::sourceCpp("cpp/dates.cpp")
2522

2623
# test.Date.ctor.sexp <- function() {
2724
fun <- ctor_sexp

inst/tinytest/test_dispatch.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
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 <- Sys.getenv("RunAllRcppTests") == "yes"
21+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2222

23-
if (!.runThisTest) exit_file("Skipping 'test_dispatch.R'")
24-
25-
library(Rcpp)
26-
sourceCpp("cpp/dispatch.cpp")
23+
Rcpp::sourceCpp("cpp/dispatch.cpp")
2724

2825
# test.RawVector <- function() {
2926
x <- as.raw(0:9)

inst/tinytest/test_embedded_r.R

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

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
20-
21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2220

2321
library(Rcpp)
2422

inst/tinytest/test_environments.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_environment.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/Environment.cpp")
21+
Rcpp::sourceCpp("cpp/Environment.cpp")
2522

2623
# test.environment.ls <- function(){
2724
e <- new.env( )

inst/tinytest/test_exceptions.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_exceptions.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/exceptions.cpp")
21+
Rcpp::sourceCpp("cpp/exceptions.cpp")
2522

2623
#test.stdException <- function() {
2724
## Code works normally without an exception

inst/tinytest/test_exceptions_nocall.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_exceptions_nocall.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/Exceptions_nocall.cpp")
21+
Rcpp::sourceCpp("cpp/Exceptions_nocall.cpp")
2522

2623
# test.Rcpp_exception <- function() {
2724
tryCatch(Rcpp_exception(), error = function(e){

inst/tinytest/test_function.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_function.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/Function.cpp")
21+
Rcpp::sourceCpp("cpp/Function.cpp")
2522

2623
# test.Function <- function(){
2724
expect_equal( function_( rnorm ), rnorm, info = "Function( CLOSXP )" )

0 commit comments

Comments
 (0)