[Roxygen-commits] r251 - in pkg: . inst inst/tests inst/tests/collate tests tests/runit tests/runit/collate

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 28 16:09:45 CET 2011


Author: hadley
Date: 2011-01-28 16:09:44 +0100 (Fri, 28 Jan 2011)
New Revision: 251

Added:
   pkg/inst/tests/
   pkg/inst/tests/Rd-example-1.R
   pkg/inst/tests/Rd-example-2.R
   pkg/inst/tests/collate/
   pkg/inst/tests/collate/belt.R
   pkg/inst/tests/collate/jacket.R
   pkg/inst/tests/collate/pants.R
   pkg/inst/tests/collate/shirt.R
   pkg/inst/tests/collate/shoes.R
   pkg/inst/tests/collate/socks.R
   pkg/inst/tests/collate/tie.R
   pkg/inst/tests/collate/undershorts.R
   pkg/inst/tests/collate/watch.R
   pkg/inst/tests/helper-roxygen.R
   pkg/inst/tests/test-Rd.R
   pkg/inst/tests/test-collate.R
   pkg/inst/tests/test-namespace.R
   pkg/tests/test-all.R
Removed:
   pkg/tests/runit.R
   pkg/tests/runit/Rd-example-1.R
   pkg/tests/runit/Rd-example-2.R
   pkg/tests/runit/collate/belt.R
   pkg/tests/runit/collate/jacket.R
   pkg/tests/runit/collate/pants.R
   pkg/tests/runit/collate/shirt.R
   pkg/tests/runit/collate/shoes.R
   pkg/tests/runit/collate/socks.R
   pkg/tests/runit/collate/tie.R
   pkg/tests/runit/collate/undershorts.R
   pkg/tests/runit/collate/watch.R
   pkg/tests/runit/runit.Rd.R
   pkg/tests/runit/runit.collate.R
   pkg/tests/runit/runit.namespace.R
Modified:
   pkg/DESCRIPTION
Log:
Convert tests to testthat

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/DESCRIPTION	2011-01-28 15:09:44 UTC (rev 251)
@@ -10,7 +10,7 @@
 Maintainer: Peter Danenberg <pcd at roxygen.org>
 URL: http://roxygen.org
 Depends: digest
-Suggests: Rgraphviz (>= 1.19.2), tools (>= 2.9.1)
+Suggests: Rgraphviz (>= 1.19.2), tools (>= 2.9.1), testthat
 Collate: 'functional.R' 'list.R' 'roxygen.R' 'string.R' 'memoize.R' 'parse.R'
     'parseS4.R' 'roclet.R' 'callgraph.R' 'description.R' 'collate.R'
     'namespace.R' 'Rd.R' 'Rdmerge.R' 'Rdapi.R' 'Rdtank.R' 'Rd2.R'

Copied: pkg/inst/tests/Rd-example-1.R (from rev 250, pkg/tests/runit/Rd-example-1.R)
===================================================================
--- pkg/inst/tests/Rd-example-1.R	                        (rev 0)
+++ pkg/inst/tests/Rd-example-1.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+example <- 'example1'

Copied: pkg/inst/tests/Rd-example-2.R (from rev 250, pkg/tests/runit/Rd-example-2.R)
===================================================================
--- pkg/inst/tests/Rd-example-2.R	                        (rev 0)
+++ pkg/inst/tests/Rd-example-2.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+example <- 'example2'

Added: pkg/inst/tests/collate/belt.R
===================================================================
--- pkg/inst/tests/collate/belt.R	                        (rev 0)
+++ pkg/inst/tests/collate/belt.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,3 @@
+#' @include collate/pants.R
+#' @include collate/shirt.R
+roxygen()

Added: pkg/inst/tests/collate/jacket.R
===================================================================
--- pkg/inst/tests/collate/jacket.R	                        (rev 0)
+++ pkg/inst/tests/collate/jacket.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,3 @@
+#' @include collate/tie.R
+#' @include collate/belt.R
+roxygen()

Added: pkg/inst/tests/collate/pants.R
===================================================================
--- pkg/inst/tests/collate/pants.R	                        (rev 0)
+++ pkg/inst/tests/collate/pants.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,2 @@
+#' @include collate/undershorts.R
+roxygen()

Copied: pkg/inst/tests/collate/shirt.R (from rev 250, pkg/tests/runit/collate/shirt.R)
===================================================================
--- pkg/inst/tests/collate/shirt.R	                        (rev 0)
+++ pkg/inst/tests/collate/shirt.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+roxygen()

Added: pkg/inst/tests/collate/shoes.R
===================================================================
--- pkg/inst/tests/collate/shoes.R	                        (rev 0)
+++ pkg/inst/tests/collate/shoes.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,4 @@
+#' @include collate/socks.R
+#' @include collate/undershorts.R
+#' @include collate/pants.R
+roxygen()

Copied: pkg/inst/tests/collate/socks.R (from rev 250, pkg/tests/runit/collate/socks.R)
===================================================================
--- pkg/inst/tests/collate/socks.R	                        (rev 0)
+++ pkg/inst/tests/collate/socks.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+roxygen()

Added: pkg/inst/tests/collate/tie.R
===================================================================
--- pkg/inst/tests/collate/tie.R	                        (rev 0)
+++ pkg/inst/tests/collate/tie.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,2 @@
+#' @include collate/shirt.R
+roxygen()

Copied: pkg/inst/tests/collate/undershorts.R (from rev 250, pkg/tests/runit/collate/undershorts.R)
===================================================================
--- pkg/inst/tests/collate/undershorts.R	                        (rev 0)
+++ pkg/inst/tests/collate/undershorts.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+roxygen()

Copied: pkg/inst/tests/collate/watch.R (from rev 250, pkg/tests/runit/collate/watch.R)
===================================================================
--- pkg/inst/tests/collate/watch.R	                        (rev 0)
+++ pkg/inst/tests/collate/watch.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1 @@
+roxygen()

Added: pkg/inst/tests/helper-roxygen.R
===================================================================
--- pkg/inst/tests/helper-roxygen.R	                        (rev 0)
+++ pkg/inst/tests/helper-roxygen.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,3 @@
+capture_roclet_output <- function(roclet, ...) {
+  capture.output(roclet$parse.parsed(parse.text(...)))
+}

Added: pkg/inst/tests/test-Rd.R
===================================================================
--- pkg/inst/tests/test-Rd.R	                        (rev 0)
+++ pkg/inst/tests/test-Rd.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,174 @@
+context("Rd")
+
+expect_rd <- function(roxygen, expected) {
+  expected <- capture_roclet_output(make.Rd.roclet())
+  expect_equal(expected, expected)
+}
+
+test_that("@example loads from specified files", {
+  expect_rd("#' @example Rd-example-1.R
+                   #' @example Rd-example-2.R
+                   roxygen()",
+                  expected=c("\\examples{example <- 'example1'",
+                    "example <- 'example2'}"))
+})
+
+test_that("@examples captures examples", {
+  expect_rd("#' @examples a <- 2
+                   roxygen()",
+                  expected="\\examples{a <- 2}")  
+})
+
+test_that("@examples overrides @example", {
+  expect_rd("#' @example expectedRd-example-1.R
+                   #' @examples a <- 2
+                   roxygen()",
+                  expected="\\examples{a <- 2}")  
+})
+
+
+test_that("empty file gives NULL expected", {
+  output <- make.Rd.roclet()$parse.parsed(parse.text(""))
+  expect_identical(output, NULL)
+})
+
+test_that("naked roxygen gives NULL expected", {
+  output <- make.Rd.roclet()$parse.parsed(parse.text("roxygen()"))
+  expect_identical(output, NULL)
+})
+
+
+test_that("name captured from assignment", {
+  expect_rd('a <- 2',
+                  expected=c('\\name{a}',
+                    '\\alias{a}',
+                    '\\title{a}'))  
+})
+
+
+test_that("@name overides default", {
+  expect_rd("#' @name b
+                   a <- 2",
+                  expected=c('\\name{b}',
+                    '\\alias{b}',
+                    '\\title{b}'))
+  
+})
+
+test_that("usage captured from formals", {
+  expect_rd("a <- function(a=1) {}",
+                  expected=c("\\name{a}",
+                    "\\alias{a}",
+                    "\\title{a}",
+                    "\\usage{a(a=1)}"))  
+})
+
+
+test_that("@usage overrides default", {
+  expect_rd("#' @usage a(a=2)
+                   a <- function(a=1) {}",
+                  expected=c("\\name{a}",
+                    "\\alias{a}",
+                    "\\title{a}",
+                    "\\usage{a(a=2)}"))  
+})
+
+
+test_that("@param documents arguments", {
+  expect_rd("#' @param a an incipit letter
+                   #' @param z a terminal letter
+                   a <- function(a=1, z=2) {}",
+                  expected=c("\\name{a}",
+                    "\\alias{a}",
+                    "\\title{a}",
+                    "\\usage{a(a=1, z=2)}",
+                    "\\arguments{\\item{a}{an incipit letter}",
+                    "\\item{z}{a terminal letter}}"))
+})
+
+test_that("description taken from first line", {
+  expect_rd("#' description
+                   roxygen()",
+                  expected="\\description{description}")  
+})
+
+test_that("details taken from subsequent lines", {
+  expect_rd("#' description
+                   #'
+                   #' details
+                   roxygen()",
+                  expected=c("\\description{description}",
+                    "\\details{details}"))
+  
+})
+
+test_that("keywords and aliases split into pieces", {
+  expect_rd("#' @keywords a b
+                   #' @aliases a b
+                   roxygen()",
+                  expected=c("\\keyword{a}",
+                    "\\keyword{b}",
+                    "\\alias{a}",
+                    "\\alias{b}"))
+})
+
+test_that("generic keys produce desired expected", {
+  expect_rd("#' @references test
+                   #' @note test
+                   #' @author test
+                   #' @seealso test
+                   #' @concept test
+                   roxygen()",
+                  expected=c("\\references{test}",
+                    "\\note{test}",
+                    "\\author{test}",
+                    "\\seealso{test}",
+                    "\\concept{test}"))  
+})
+
+test_that("title taken from first sentence", {
+  expect_rd("#' Description with sentence. That continueth.
+                   a <- 2",
+                  expected=c("\\name{a}",
+                    "\\alias{a}",
+                    "\\title{Description with sentence.}",
+                    paste("\\description{Description with sentence.",
+                          "That continueth.}")))
+  
+})
+
+test_that("@title overrides default title", {
+  expect_rd("#' Would be title
+                   #' @title Overridden title
+                   roxygen()",
+                  expected=c("\\title{Overridden title}",
+                    "\\description{Would be title}"))  
+})
+
+
+test_that("question mark ends sentence", {
+  expect_rd("#' Is a number odd?
+                   is.odd <- function(a) {}",
+                  expected=c('\\name{is.odd}',
+                    '\\alias{is.odd}',
+                    '\\title{Is a number odd?}',
+                    '\\usage{is.odd(a)}',
+                    '\\description{Is a number odd?}'))  
+})
+
+test_that("no ending punctuation produces ellipsis", {
+  expect_rd("#' Whether a number is odd
+                   is.odd <- function(a) {}",
+                  expected=c('\\name{is.odd}',
+                    '\\alias{is.odd}',
+                    '\\title{Whether a number is odd...}',
+                    '\\usage{is.odd(a)}',
+                    '\\description{Whether a number is odd}'))  
+})
+
+test_that("@TODO creates todo section", {
+  expect_rd("#' @TODO test this
+                   roxygen()",
+                  expected=c('\\section{TODO}{test this}'))
+  
+})

Added: pkg/inst/tests/test-collate.R
===================================================================
--- pkg/inst/tests/test-collate.R	                        (rev 0)
+++ pkg/inst/tests/test-collate.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,19 @@
+context("Collation")
+
+test_that("collation as expected", {
+
+  roclet <- make.collate.roclet()
+  collation <- capture.output(roclet$parse('collate/belt.R',
+                                           'collate/jacket.R',
+                                           'collate/pants.R',
+                                           'collate/shirt.R',
+                                           'collate/shoes.R',
+                                           'collate/socks.R',
+                                           'collate/tie.R',
+                                           'collate/undershorts.R',
+                                           'collate/watch.R'))
+                                           
+  collation <- gsub("\\s +", " ", paste(collation, collapse = ""))
+  expect_equal(collation,
+    c("Collate: 'collate/shirt.R' 'collate/undershorts.R' 'collate/pants.R' 'collate/belt.R' 'collate/tie.R' 'collate/jacket.R' 'collate/socks.R' 'collate/shoes.R' 'collate/watch.R'"))
+})
\ No newline at end of file

Added: pkg/inst/tests/test-namespace.R
===================================================================
--- pkg/inst/tests/test-namespace.R	                        (rev 0)
+++ pkg/inst/tests/test-namespace.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,59 @@
+context("Namespace")
+
+expect_namespace <- function(roxygen, expected) {
+  output <- capture_roclet_output(make.namespace.roclet(), roxygen)
+  expect_equal(output, expected)
+}
+
+test_that("export detects object name", {
+  expect_namespace("#' @export
+                          a <- 2",
+                         expected='export(a)')  
+})
+
+test_that("export parameter overrides default", {
+  expect_namespace("#' @export b
+                          a <- 2",
+                         expected='export(b)')  
+})
+
+test_that("export detects S4 class", {
+  expect_namespace("#' @export
+                          setClass('a')",
+                         expected='exportClasses(a)')  
+})
+
+
+test_that("exportClass overrides default class name", {
+  expect_namespace("#' @exportClass b
+                          setClass('a')",
+                         expected='exportClasses(b)')  
+})
+
+test_that("export detects method name", {
+  expect_namespace("#' @export
+                          setMethod('b', 'a')",
+                         expected='exportMethods(b)')  
+})
+
+test_that("exportMethod overrides default method name", {
+  expect_namespace("#' @exportMethod c
+                          setMethod('b', 'a')",
+                         expected='exportMethods(c)')  
+})
+
+test_that("other namespace tags produce correct output", {
+  expect_namespace("#' @exportPattern test
+                          #' @S3method test test
+                          #' @import test
+                          #' @importFrom test test
+                          #' @importClassesFrom test test
+                          #' @importMethodsFrom test test
+                          roxygen()",
+                         expected=c("exportPattern(test)",
+                           "S3method(test, test)",
+                           "import(test)",
+                           "importFrom(test, test)",
+                           "importClassesFrom(test, test)",
+                           "importMethodsFrom(test, test)"))  
+})

Deleted: pkg/tests/runit/Rd-example-1.R
===================================================================
--- pkg/tests/runit/Rd-example-1.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/Rd-example-1.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-example <- 'example1'

Deleted: pkg/tests/runit/Rd-example-2.R
===================================================================
--- pkg/tests/runit/Rd-example-2.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/Rd-example-2.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-example <- 'example2'

Deleted: pkg/tests/runit/collate/belt.R
===================================================================
--- pkg/tests/runit/collate/belt.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/belt.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,3 +0,0 @@
-#' @include runit/collate/pants.R
-#' @include runit/collate/shirt.R
-roxygen()

Deleted: pkg/tests/runit/collate/jacket.R
===================================================================
--- pkg/tests/runit/collate/jacket.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/jacket.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,3 +0,0 @@
-#' @include runit/collate/tie.R
-#' @include runit/collate/belt.R
-roxygen()

Deleted: pkg/tests/runit/collate/pants.R
===================================================================
--- pkg/tests/runit/collate/pants.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/pants.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,2 +0,0 @@
-#' @include runit/collate/undershorts.R
-roxygen()

Deleted: pkg/tests/runit/collate/shirt.R
===================================================================
--- pkg/tests/runit/collate/shirt.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/shirt.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-roxygen()

Deleted: pkg/tests/runit/collate/shoes.R
===================================================================
--- pkg/tests/runit/collate/shoes.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/shoes.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,4 +0,0 @@
-#' @include runit/collate/socks.R
-#' @include runit/collate/undershorts.R
-#' @include runit/collate/pants.R
-roxygen()

Deleted: pkg/tests/runit/collate/socks.R
===================================================================
--- pkg/tests/runit/collate/socks.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/socks.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-roxygen()

Deleted: pkg/tests/runit/collate/tie.R
===================================================================
--- pkg/tests/runit/collate/tie.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/tie.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,2 +0,0 @@
-#' @include runit/collate/shirt.R
-roxygen()

Deleted: pkg/tests/runit/collate/undershorts.R
===================================================================
--- pkg/tests/runit/collate/undershorts.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/undershorts.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-roxygen()

Deleted: pkg/tests/runit/collate/watch.R
===================================================================
--- pkg/tests/runit/collate/watch.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/collate/watch.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1 +0,0 @@
-roxygen()

Deleted: pkg/tests/runit/runit.Rd.R
===================================================================
--- pkg/tests/runit/runit.Rd.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/runit.Rd.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,145 +0,0 @@
-check.Rd.roclet <- Curry(check.roclet,
-                         make.roclet=make.Rd.roclet)
-
-check.Rd.output <- Curry(check.output,
-                         make.roclet=make.Rd.roclet)
-
-test.example.files <- function()
-  check.Rd.output("#' @example runit/Rd-example-1.R
-                   #' @example runit/Rd-example-2.R
-                   roxygen()",
-                  output=c("\\examples{example <- 'example1'",
-                    "example <- 'example2'}"))
-
-test.free.example <- function()
-  check.Rd.output("#' @examples a <- 2
-                   roxygen()",
-                  output="\\examples{a <- 2}")
-
-test.free.example.overriding.example.file <- function()
-  check.Rd.output("#' @example runit/Rd-example-1.R
-                   #' @examples a <- 2
-                   roxygen()",
-                  output="\\examples{a <- 2}")
-
-test.blank.file <- function()
-  check.Rd.roclet(function(roclet)
-                  checkTrue(is.null(roclet$parse.parsed(parse.text("")))))
-
-test.naked.roxygen <- function()
-  check.Rd.roclet(function(roclet)
-                  checkTrue(is.null(roclet$parse.parsed
-                                    (parse.text("roxygen()")))))
-
-test.name.from.assignment <- function()
-  check.Rd.output('a <- 2',
-                  output=c('\\name{a}',
-                    '\\alias{a}',
-                    '\\title{a}'))
-
-test.name.overriding.assignment <- function()
-  check.Rd.output("#' @name b
-                   a <- 2",
-                  output=c('\\name{b}',
-                    '\\alias{b}',
-                    '\\title{b}'))
-
-test.implicit.usage.from.formals <- function()
-  check.Rd.output("a <- function(a=1) {}",
-                  output=c("\\name{a}",
-                    "\\alias{a}",
-                    "\\title{a}",
-                    "\\usage{a(a=1)}"))
-
-test.explicit.usage <- function()
-  check.Rd.output("#' @usage a(a=2)
-                   a <- function(a=1) {}",
-                  output=c("\\name{a}",
-                    "\\alias{a}",
-                    "\\title{a}",
-                    "\\usage{a(a=2)}"))
-
-test.params <- function()
-  check.Rd.output("#' @param a an incipit letter
-                   #' @param z a terminal letter
-                   a <- function(a=1, z=2) {}",
-                  output=c("\\name{a}",
-                    "\\alias{a}",
-                    "\\title{a}",
-                    "\\usage{a(a=1, z=2)}",
-                    "\\arguments{\\item{a}{an incipit letter}",
-                    "\\item{z}{a terminal letter}}"))
-
-test.description <- function()
-  check.Rd.output("#' description
-                   roxygen()",
-                  output="\\description{description}")
-
-test.description.details <- function()
-  check.Rd.output("#' description
-                   #'
-                   #' details
-                   roxygen()",
-                  output=c("\\description{description}",
-                    "\\details{details}"))
-
-test.splitting.keys <- function()
-  check.Rd.output("#' @keywords a b
-                   #' @aliases a b
-                   roxygen()",
-                  output=c("\\keyword{a}",
-                    "\\keyword{b}",
-                    "\\alias{a}",
-                    "\\alias{b}"))
-
-test.generic.keys <- function()
-  check.Rd.output("#' @references test
-                   #' @note test
-                   #' @author test
-                   #' @seealso test
-                   #' @concept test
-                   roxygen()",
-                  output=c("\\references{test}",
-                    "\\note{test}",
-                    "\\author{test}",
-                    "\\seealso{test}",
-                    "\\concept{test}"))
-
-test.title.from.description <- function()
-  check.Rd.output("#' Description with sentence. That continueth.
-                   a <- 2",
-                  output=c("\\name{a}",
-                    "\\alias{a}",
-                    "\\title{Description with sentence.}",
-                    paste("\\description{Description with sentence.",
-                          "That continueth.}")))
-
-test.override.title <- function()
-  check.Rd.output("#' Would be title
-                   #' @title Overridden title
-                   roxygen()",
-                  output=c("\\title{Overridden title}",
-                    "\\description{Would be title}"))
-
-test.question.mark.end.of.sentence <- function()
-  check.Rd.output("#' Is a number odd?
-                   is.odd <- function(a) {}",
-                  output=c('\\name{is.odd}',
-                    '\\alias{is.odd}',
-                    '\\title{Is a number odd?}',
-                    '\\usage{is.odd(a)}',
-                    '\\description{Is a number odd?}'))
-
-test.ellipsis.on.no.period <- function()
-  check.Rd.output("#' Whether a number is odd
-                   is.odd <- function(a) {}",
-                  output=c('\\name{is.odd}',
-                    '\\alias{is.odd}',
-                    '\\title{Whether a number is odd...}',
-                    '\\usage{is.odd(a)}',
-                    '\\description{Whether a number is odd}'))
-
-test.todo <- function()
-  check.Rd.output("#' @TODO test this
-                   roxygen()",
-                  output=c('\\section{TODO}{test this}'))

Deleted: pkg/tests/runit/runit.collate.R
===================================================================
--- pkg/tests/runit/runit.collate.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/runit.collate.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,20 +0,0 @@
-## TODO: merge test
-test.collate <- function() {
-  roclet <- make.collate.roclet()
-  collation <- capture.output(roclet$parse('runit/collate/belt.R',
-                                           'runit/collate/jacket.R',
-                                           'runit/collate/pants.R',
-                                           'runit/collate/shirt.R',
-                                           'runit/collate/shoes.R',
-                                           'runit/collate/socks.R',
-                                           'runit/collate/tie.R',
-                                           'runit/collate/undershorts.R',
-                                           'runit/collate/watch.R'))
-  checkEquals(collation,
-              c("Collate: 'runit/collate/shirt.R' 'runit/collate/undershorts.R'",
-                "    'runit/collate/pants.R' 'runit/collate/belt.R'",
-                "    'runit/collate/tie.R' 'runit/collate/jacket.R'",
-                "    'runit/collate/socks.R' 'runit/collate/shoes.R'",
-                "    'runit/collate/watch.R'"),
-              msg=collation)
-}

Deleted: pkg/tests/runit/runit.namespace.R
===================================================================
--- pkg/tests/runit/runit.namespace.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit/runit.namespace.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,47 +0,0 @@
-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.generic.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)"))

Deleted: pkg/tests/runit.R
===================================================================
--- pkg/tests/runit.R	2010-08-05 17:15:36 UTC (rev 250)
+++ pkg/tests/runit.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -1,21 +0,0 @@
-check.roclet <- function(make.roclet, test) {
-  roclet <- make.roclet()
-  test(roclet)
-}
-
-check.output <- function(..., make.roclet, output)
-  check.roclet(make.roclet,
-               test=function(roclet) {
-                 parsed <- capture.output(roclet$parse.parsed(parse.text(...)))
-                 checkEquals(parsed, output, msg=parsed)
-               })
-
-if (require('RUnit')) {
-  library(roxygen)
-  roclets <- defineTestSuite('roclets', 'runit')
-  results <- runTestSuite(roclets)
-  printTextProtocol(results)
-  errors <- getErrors(results)
-  if (errors$nFail > 0 || errors$nErr > 0)
-    stop('roclet unit suite failed')
-}

Added: pkg/tests/test-all.R
===================================================================
--- pkg/tests/test-all.R	                        (rev 0)
+++ pkg/tests/test-all.R	2011-01-28 15:09:44 UTC (rev 251)
@@ -0,0 +1,4 @@
+library(testthat)
+library(roxygen)
+
+test_package("roxygen")
\ No newline at end of file



More information about the Roxygen-commits mailing list