Skip to content

Commit 40c9a00

Browse files
using Rf_isNull instead of == R_NilValue
1 parent 945de9e commit 40c9a00

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

R/unit.tests.R

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

18-
test <- function( output = if( file.exists( "/tmp" ) ) "/tmp" else getwd() ){
19-
if( !file.exists( output ) ){ stop( "output directory does not exist" ) }
18+
run_unit_tests <- function( output = if( file.exists( "/tmp" ) ) "/tmp" else getwd(), package = "Rcpp" ){
19+
if( !file.exists( output ) ){
20+
stop( "output directory does not exist" )
21+
}
2022

2123
Rscript <- file.path( R.home( component = "bin" ), "Rscript" )
2224
if( .Platform$OS.type == "windows" ){
2325
Rscript <- sprintf( "%s.exe", Rscript )
2426
}
25-
test.script <- system.file( "unitTests", "runTests.R", package = "Rcpp" )
27+
test.script <- system.file( "unitTests", "runTests.R", package = package )
2628
cmd <- sprintf( '"%s" "%s" --output=%s', Rscript, test.script, output )
2729
system( cmd )
2830
}
2931

32+
test <- function( output = if( file.exists( "/tmp" ) ) "/tmp" else getwd() ){
33+
message( "test is deprecated, use `run_unit_test` instead" )
34+
run_unit_tests( output, "Rcpp" )
35+
}
36+
3037
unit_test_setup <- function(file, packages = NULL) {
3138
function(){
3239
if( !is.null(packages) ){

inst/include/Rcpp/internal/Exporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace Rcpp{
7878

7979
T get() {
8080
Shield<SEXP> dims( ::Rf_getAttrib( object, R_DimSymbol ) ) ;
81-
if( dims == R_NilValue || ::Rf_length(dims) != 2 ){
81+
if( Rf_isNull(dims) || ::Rf_length(dims) != 2 ){
8282
throw ::Rcpp::not_a_matrix() ;
8383
}
8484
int* dims_ = INTEGER(dims) ;

0 commit comments

Comments
 (0)