Skip to content

Commit 3c36f7f

Browse files
authored
Respond to upcoming changes in glue::glue_collapse() (#310)
* Respond to changes proposed in tidyverse/glue#295 * Use the glue PR * Remove glue remote, put back in Suggests (not Imports) * Skip empty string tests for insufficient glue version
1 parent 2ddc12f commit 3c36f7f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

R/register.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ get_call_entries <- function(path, names, package) {
273273

274274
redundant <- glue::glue_collapse(glue::glue('extern SEXP _{package}_{names}'), sep = '|')
275275

276-
if (length(redundant) > 0) {
276+
if (length(redundant) > 0 && nzchar(redundant)) {
277277
redundant <- paste0("^", redundant)
278278
res <- res[!grepl(redundant, res)]
279279
}

tests/testthat/test-register.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ describe("get_registered_functions", {
208208

209209
describe("generate_cpp_functions", {
210210
it("returns the empty string if there are no functions", {
211+
skip_if_not_installed("glue", "1.6.2.9000")
212+
211213
funs <- tibble::tibble(
212214
file = character(),
213215
line = integer(),
@@ -219,7 +221,7 @@ describe("generate_cpp_functions", {
219221
args = list(tibble::tibble(type = character(), name = character()))
220222
)
221223

222-
expect_equal(generate_cpp_functions(funs), character())
224+
expect_equal(generate_cpp_functions(funs), "")
223225
})
224226

225227
it("returns the wrapped function for a single void function with no arguments", {
@@ -377,6 +379,8 @@ extern \"C\" SEXP _cpp11_bar(SEXP baz) {
377379

378380
describe("generate_r_functions", {
379381
it("returns the empty string if there are no functions", {
382+
skip_if_not_installed("glue", "1.6.2.9000")
383+
380384
funs <- tibble::tibble(
381385
file = character(),
382386
line = integer(),
@@ -388,7 +392,7 @@ describe("generate_r_functions", {
388392
args = list()
389393
)
390394

391-
expect_equal(generate_r_functions(funs), character())
395+
expect_equal(generate_r_functions(funs), "")
392396
})
393397

394398
it("returns the wrapped function for a single void function with no arguments", {

0 commit comments

Comments
 (0)