[Roxygen-commits] r87 - in pkg/tests: . runit

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 25 07:04:07 CEST 2008


Author: pcd
Date: 2008-07-25 07:04:06 +0200 (Fri, 25 Jul 2008)
New Revision: 87

Added:
   pkg/tests/runit/runit.namespace.R
Modified:
   pkg/tests/runit.R
   pkg/tests/runit/runit.Rd.R
Log:
namespace tests


Modified: pkg/tests/runit/runit.Rd.R
===================================================================
--- pkg/tests/runit/runit.Rd.R	2008-07-25 04:42:07 UTC (rev 86)
+++ pkg/tests/runit/runit.Rd.R	2008-07-25 05:04:06 UTC (rev 87)
@@ -24,11 +24,12 @@
 
 test.blank.file <- function()
   check.Rd.roclet(function(roclet)
-                  is.null(roclet$parse.parsed(parse.text(""))))
+                  checkTrue(is.null(roclet$parse.parsed(parse.text("")))))
 
 test.naked.roxygen <- function()
   check.Rd.roclet(function(roclet)
-                  is.null(roclet$parse.parsed(parse.text("roxygen()"))))
+                  checkTrue(is.null(roclet$parse.parsed
+                                    (parse.text("roxygen()")))))
 
 test.name.from.assignment <- function()
   check.Rd.output('a <- 2',

Added: pkg/tests/runit/runit.namespace.R
===================================================================
--- pkg/tests/runit/runit.namespace.R	                        (rev 0)
+++ pkg/tests/runit/runit.namespace.R	2008-07-25 05:04:06 UTC (rev 87)
@@ -0,0 +1,47 @@
+check.namespace.output <- Curry(check.output,
+                                make.roclet=make.namespace.roclet)
+
+test.export <- function()
+  check.namespace.output("#' @export
+                          a <- 2",
+                         output='export(a)')
+
+test.export.override <- function()
+  check.namespace.output("#' @export b
+                          a <- 2",
+                         output='export(b)')
+
+test.export.S4class <- function()
+  check.namespace.output("#' @export
+                          setClass('a')",
+                         output='exportClasses(a)')
+
+test.override.S4class <- function()
+  check.namespace.output("#' @exportClass b
+                          setClass('a')",
+                         output='exportClasses(b)')
+
+test.export.S4method <- function()
+  check.namespace.output("#' @export
+                          setMethod('b', 'a')",
+                         output='exportMethods(b)')
+
+test.override.S4method <- function()
+  check.namespace.output("#' @exportMethod c
+                          setMethod('b', 'a')",
+                         output='exportMethods(c)')
+
+test.keys <- function()
+  check.namespace.output("#' @exportPattern test
+                          #' @S3method test test
+                          #' @import test
+                          #' @importFrom test test
+                          #' @importClassesFrom test test
+                          #' @importMethodsFrom test test
+                          roxygen()",
+                         output=c("exportPattern(test)",
+                           "S3method(test, test)",
+                           "import(test)",
+                           "importFrom(test, test)",
+                           "importClassesFrom(test, test)",
+                           "importMethodsFrom(test, test)"))

Modified: pkg/tests/runit.R
===================================================================
--- pkg/tests/runit.R	2008-07-25 04:42:07 UTC (rev 86)
+++ pkg/tests/runit.R	2008-07-25 05:04:06 UTC (rev 87)
@@ -5,10 +5,10 @@
 
 check.output <- function(..., make.roclet, output)
   check.roclet(make.roclet,
-               test=function(roclet)
-               checkEquals(capture.output(roclet$parse.parsed
-                                          (parse.text(...))),
-                           output))
+               test=function(roclet) {
+                 parsed <- capture.output(roclet$parse.parsed(parse.text(...)))
+                 checkEquals(parsed, output, msg=parsed)
+               })
 
 if (require('RUnit')) {
   library(roxygen)



More information about the Roxygen-commits mailing list