[Sciviews-commits] r365 - pkg/svUnit/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Mar 15 13:39:56 CET 2011
Author: mariotomo
Date: 2011-03-15 13:39:55 +0100 (Tue, 15 Mar 2011)
New Revision: 365
Modified:
pkg/svUnit/R/svSuite.R
Log:
solving ticket:1327
using a new local identifier to refer to the last test environment.
the environment is stored globally in the same global identifier as before.
Modified: pkg/svUnit/R/svSuite.R
===================================================================
--- pkg/svUnit/R/svSuite.R 2011-03-09 02:11:46 UTC (rev 364)
+++ pkg/svUnit/R/svSuite.R 2011-03-15 12:39:55 UTC (rev 365)
@@ -276,27 +276,28 @@
for (unit in names(.lastSuite)) {
## Create a new environment for this suite (created in .GlobalEnv so
## that we can inspect it in case of stop on error)
- .TestSuiteEnv <<- new.env(parent = .GlobalEnv)
+ .ThisTestSuiteEnv <- new.env(parent = .GlobalEnv)
+ .TestSuiteEnv <<- .ThisTestSuiteEnv
## Source the corresponding file
Unit <- .lastSuite[[unit]]$file
- sys.source(Unit, envir = .TestSuiteEnv)
+ sys.source(Unit, envir = .ThisTestSuiteEnv)
## Make sure there are .setUp() and .tearDown() functions
- if (!exists(".setUp", envir = .TestSuiteEnv, mode = "function",
+ if (!exists(".setUp", envir = .ThisTestSuiteEnv, mode = "function",
inherits = FALSE))
- .TestSuiteEnv$.setUp <- function() {}
- if (!exists(".tearDown", envir = .TestSuiteEnv, mode = "function",
+ .ThisTestSuiteEnv$.setUp <- function() {}
+ if (!exists(".tearDown", envir = .ThisTestSuiteEnv, mode = "function",
inherits = FALSE))
- .TestSuiteEnv$.tearDown <- function() {}
+ .ThisTestSuiteEnv$.tearDown <- function() {}
## List all test files in the unit
- tests <- ls(.TestSuiteEnv, pattern = "^test.+$")
+ tests <- ls(.ThisTestSuiteEnv, pattern = "^test.+$")
## Keep only 'test*' objects that are function
keep <- unlist(lapply(tests, function(n) exists(n,
- envir = .TestSuiteEnv, mode = "function", inherits = FALSE)))
+ envir = .ThisTestSuiteEnv, mode = "function", inherits = FALSE)))
tests <- tests[keep]
.Log$.lastSuite[[unit]]$tests <- tests
## Run each test in turn
for (test in tests) {
- .runTest(envir = .TestSuiteEnv, test = test, unit = Unit)
+ .runTest(envir = .ThisTestSuiteEnv, test = test, unit = Unit)
}
}
return(invisible(files))
More information about the Sciviews-commits
mailing list