Skip to content

Commit

Permalink
Alias \dots to ... in more places
Browse files Browse the repository at this point in the history
Fixes #504
  • Loading branch information
hadley committed Sep 21, 2016
1 parent effde02 commit bb7d7de
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
a single section from another topic (#513).

* `@inheritParams` now works recursively, so that you can inherit parameters
from a function that inherited its paramters from somewhere else.
from a function that inherited its paramters from somewhere else. It
also better handles `\dots` as an alias for `...` (#504).

* Back references are now wrapped over multiple lines, if long
(#493, @LiNk-NY).
Expand Down
1 change: 1 addition & 0 deletions R/rd-inherit.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ get_documented_params <- function(topic, only_first = FALSE) {
documented <- unlist(documented)
}

documented[documented == "\\dots"] <- "..."
documented
}

Expand Down
23 changes: 23 additions & 0 deletions tests/testthat/test-Rd-inherit.R
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,26 @@ test_that("argument order with @inheritParam", {
expect_equal(get_tag(out[["c1.Rd"]], "param")$values, c(x="C", y="Y"))
expect_equal(get_tag(out[["c2.Rd"]], "param")$values, c(x="C", y="Y"))
})


test_that("inherit params ... named \\dots", {
out <- roc_proc_text(rd_roclet(), "
#' Foo
#'
#' @param x x
#' @param \\dots foo
foo <- function(x, ...) {}
#' Bar
#'
#' @inheritParams foo
#' @param \\dots bar
bar <- function(x=1, ...) {}
")[[2]]

expect_equal(
out$get_field("param")$values,
c(x = "x", "\\dots" = "bar")
)

})

0 comments on commit bb7d7de

Please sign in to comment.