[Rcpp-commits] r1075 - in pkg/Rcpp/inst/unitTests: . RcppTestA/src RcppTestB/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 18 23:32:02 CEST 2010


Author: romain
Date: 2010-04-18 23:32:02 +0200 (Sun, 18 Apr 2010)
New Revision: 1075

Modified:
   pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
   pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h
   pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp
   pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.h
   pkg/Rcpp/inst/unitTests/runit.client.package.R
Log:
testing exceptions in client packages

Modified: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	2010-04-18 21:28:17 UTC (rev 1074)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	2010-04-18 21:32:02 UTC (rev 1075)
@@ -8,6 +8,11 @@
 	return z ;
 }
 
+SEXP hello_world_ex(){
+	throw std::range_error( "boom" ) ;
+	return R_NilValue ;
+}
+
 #if defined(WIN32)
 extern "C" void R_init_RcppTestA( DllInfo* info){
 	std::set_terminate( forward_uncaught_exceptions_to_r ) ;

Modified: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h	2010-04-18 21:28:17 UTC (rev 1074)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h	2010-04-18 21:32:02 UTC (rev 1075)
@@ -4,5 +4,6 @@
 #include <Rcpp.h>
 
 RcppExport SEXP rcpp_hello_world() ;
+RcppExport SEXP hello_world_ex() ;
 
 #endif

Modified: pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp	2010-04-18 21:28:17 UTC (rev 1074)
+++ pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.cpp	2010-04-18 21:32:02 UTC (rev 1075)
@@ -8,6 +8,11 @@
 	return z ;
 }
 
+SEXP hello_world_ex(){
+	throw std::range_error( "boom" ) ;
+	return R_NilValue ;
+}
+
 #if defined(WIN32)
 extern "C" void R_init_RcppTestB( DllInfo* info){
 	std::set_terminate( forward_uncaught_exceptions_to_r ) ;

Modified: pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.h
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.h	2010-04-18 21:28:17 UTC (rev 1074)
+++ pkg/Rcpp/inst/unitTests/RcppTestB/src/rcpp_hello_world.h	2010-04-18 21:32:02 UTC (rev 1075)
@@ -4,5 +4,6 @@
 #include <Rcpp.h>
 
 RcppExport SEXP rcpp_hello_world() ;
+RcppExport SEXP hello_world_ex() ;
 
 #endif

Modified: pkg/Rcpp/inst/unitTests/runit.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.client.package.R	2010-04-18 21:28:17 UTC (rev 1074)
+++ pkg/Rcpp/inst/unitTests/runit.client.package.R	2010-04-18 21:32:02 UTC (rev 1075)
@@ -34,6 +34,7 @@
 	hello_world <- get( "rcpp_hello_world", asNamespace( pkg ) )
 	checkEquals( hello_world(), list( c("foo", "bar"), c(0.0, 1.0) ), msg = "code from client package" )
 	
+	checkException( .Call("hello_world_ex", PACKAGE = pkg ), msg = "exception in client package" )
 }
 
 test.client.package <- function(){



More information about the Rcpp-commits mailing list