[Rcpp-commits] r1067 - pkg/Rcpp/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 18 21:31:30 CEST 2010


Author: romain
Date: 2010-04-18 21:31:29 +0200 (Sun, 18 Apr 2010)
New Revision: 1067

Removed:
   pkg/Rcpp/inst/unitTests/RcppTestA_1.0.tar.gz
Modified:
   pkg/Rcpp/inst/unitTests/runit.client.package.R
Log:
rebuild the client test package each time rather than carry the tar.gz in svn

Deleted: pkg/Rcpp/inst/unitTests/RcppTestA_1.0.tar.gz
===================================================================
(Binary files differ)

Modified: pkg/Rcpp/inst/unitTests/runit.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.client.package.R	2010-04-18 19:00:37 UTC (rev 1066)
+++ pkg/Rcpp/inst/unitTests/runit.client.package.R	2010-04-18 19:31:29 UTC (rev 1067)
@@ -17,17 +17,26 @@
 # You should have received a copy of the GNU General Public License
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-test.client.package <- function(){
+.client.package <- function( pkg = "RcppTestA" ){
 	td <- tempfile()
 	cwd <- getwd()
 	dir.create( td )
-	file.copy( system.file( "unitTests", "RcppTestA_1.0.tar.gz", package = "Rcpp" ) , td ) 
+	file.copy( system.file( "unitTests", pkg, package = "Rcpp" ) , td, recursive = TRUE) 
 	setwd( td )
 	on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
+	R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
+	cmd <- paste( R , "CMD build", pkg ) 
+	system( cmd )
 	dir.create( "templib" )
-	install.packages( "RcppTestA_1.0.tar.gz", "templib", repos = NULL, type = "source" )
-	require( "RcppTestA", "templib" )
-	res <- RcppTestA:::rcpp_hello_world( )
-	checkEquals( res, list( c("foo", "bar"), c(0.0, 1.0) ), msg = "code from client package" )
+	install.packages( paste( pkg, "_1.0.tar.gz", sep = "" ), "templib", repos = NULL, type = "source" )
+	require( pkg, "templib", character.only = TRUE )
+	
+	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" )
+	
 }
 
+test.client.package <- function(){
+	.client.package( "RcppTestA" )
+}
+



More information about the Rcpp-commits mailing list