Skip to content

Commit 91eb183

Browse files
committed
modified old RcppTestA package to testRcppPackage
updated test for source package slightly
1 parent 8ddc3fa commit 91eb183

File tree

17 files changed

+134
-62
lines changed

17 files changed

+134
-62
lines changed

inst/unitTests/RcppTestA/DESCRIPTION

Lines changed: 0 additions & 12 deletions
This file was deleted.

inst/unitTests/RcppTestA/NAMESPACE

Lines changed: 0 additions & 1 deletion
This file was deleted.

inst/unitTests/RcppTestA/R/rcpp_hello_world.R

Lines changed: 0 additions & 3 deletions
This file was deleted.

inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/r -t
22
#
3-
# Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
3+
# Copyright (C) 2010 - 2014 Dirk Eddelbuettel and Romain Francois
44
#
55
# This file is part of Rcpp.
66
#
@@ -22,28 +22,28 @@
2222

2323
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
2424

25-
.client.package <- function( pkg = "RcppTestA" ){
25+
.client.package <- function(pkg = "testRcppPackage") {
2626
td <- tempfile()
2727
cwd <- getwd()
28-
dir.create( td )
29-
file.copy( system.file( "unitTests", pkg, package = "Rcpp" ) , td, recursive = TRUE)
30-
setwd( td )
31-
on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
32-
R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
33-
cmd <- paste( R , "CMD build", pkg )
34-
system( cmd )
35-
dir.create( "templib" )
36-
install.packages( paste( pkg, "_1.0.tar.gz", sep = "" ), "templib", repos = NULL, type = "source" )
37-
require( pkg, "templib", character.only = TRUE )
28+
dir.create(td)
29+
file.copy(system.file("unitTests", pkg, package = "Rcpp"), td, recursive = TRUE)
30+
setwd(td)
31+
on.exit( { setwd(cwd); unlink(td, recursive = TRUE) } )
32+
R <- shQuote(file.path( R.home(component = "bin"), "R"))
33+
cmd <- paste(R, "CMD build", pkg)
34+
system(cmd)
35+
dir.create("templib")
36+
install.packages(paste0(pkg, "_1.0.tar.gz"), "templib", repos = NULL, type = "source")
37+
require(pkg, lib.loc = "templib", character.only = TRUE)
38+
hello_world <- get("rcpp_hello_world", asNamespace(pkg))
39+
checkEquals(hello_world(), list(c("foo", "bar"), c(0.0, 1.0)),
40+
msg = "code from client package")
3841

39-
hello_world <- get( "rcpp_hello_world", asNamespace( pkg ) )
40-
checkEquals( hello_world(), list( c("foo", "bar"), c(0.0, 1.0) ), msg = "code from client package" )
41-
42-
checkException( .Call("hello_world_ex", PACKAGE = pkg ), msg = "exception in client package" )
42+
checkException(.Call("hello_world_ex", PACKAGE = pkg), msg = "exception in client package")
4343
}
4444

45-
if ( .runThisTest && ! .onWindows ) {
46-
test.client.packageA <- function(){
47-
.client.package( "RcppTestA" )
45+
if (.runThisTest && ! .onWindows) {
46+
test.client.testRcppPackage <- function() {
47+
.client.package("testRcppPackage")
4848
}
4949
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Package: testRcppPackage
2+
Type: Package
3+
Title: Small Test Package for Rcpp and Part of Rcpp Unit Tests
4+
Version: 1.0
5+
Date: 2010-04-10
6+
Author: Dirk Eddelbuettel and Romain Francois
7+
Maintainer: Dirk Eddelbuettel <edd@debian.org>
8+
Description: Small test package uses as part of Rcpp unit tests
9+
License: GPL (>= 2)
10+
LazyLoad: yes
11+
Imports: Rcpp
12+
LinkingTo: Rcpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
useDynLib(testRcppPackage)
2+
import(Rcpp)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rcpp_hello_world <- function() {
2+
.Call("rcpp_hello_world", PACKAGE = "testRcppPackage")
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
r-cran-testrcpppackage (0.1.0-1) unstable; urgency=low
2+
3+
* Initial version
4+
5+
* debian/control: Remove (Build-)Depends: on r-cran-rcpp as this package is
6+
internal and just used for testing from source when the packaged R binary
7+
may not be installed
8+
9+
-- Dirk Eddelbuettel <edd@debian.org> Fri, 03 Oct 2014 08:25:46 -0500
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7

0 commit comments

Comments
 (0)