From c6995504df211bc100f54e0e8d6c3fd5a7420304 Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Fri, 29 Jun 2018 11:56:10 -0400 Subject: [PATCH] Fix shim_help to work with ::: inputs Fixes #72 --- NEWS.md | 2 ++ R/dev-topic.r | 2 +- tests/testthat/test-help.r | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a0b854f8..0deeeb5b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +* The help shim's now work for `:::` inputs (#72). + # pkgload 1.0.0 * `load_all()` now updates imports of dependent packages when a package is diff --git a/R/dev-topic.r b/R/dev-topic.r index 383c2fc4..54e28cad 100644 --- a/R/dev-topic.r +++ b/R/dev-topic.r @@ -31,7 +31,7 @@ dev_topic_find <- function(topic, dev_packages = NULL) { dev_topic_parse <- function(topic, dev_packages = NULL) { stopifnot(is.character(topic), length(topic) == 1) - pieces <- strsplit(topic, "::")[[1]] + pieces <- strsplit(topic, ":::?")[[1]] if (length(pieces) == 1) { if (is.null(dev_packages)) { pkgs <- dev_packages() diff --git a/tests/testthat/test-help.r b/tests/testthat/test-help.r index 307a4e08..57da482c 100644 --- a/tests/testthat/test-help.r +++ b/tests/testthat/test-help.r @@ -11,6 +11,10 @@ test_that("shim_help behaves the same as utils::help for non-devtools-loaded pac expect_identical(shim_help('lm', stats)[1], utils::help('lm', stats)[1]) expect_identical(shim_help('lm', 'stats')[1], utils::help('lm', 'stats')[1]) expect_identical(shim_help(, "stats")[1], utils::help(, "stats")[1]) + + # Works for :: and ::: as well (#72) + expect_identical(shim_help("::")[1], utils::help("::")[1]) + expect_identical(shim_help(":::")[1], utils::help(":::")[1]) }) test_that("shim_help behaves the same as utils::help for nonexistent objects", {