Skip to content

.Call() entries might have (void) #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* `cpp_source()` errors on non-existent file (#261).

* updated test to adapt to changes in R 4.2.1 (#290).

# cpp11 0.4.2

* Romain François is now the maintainer.
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-register.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ describe("get_call_entries", {
path <- pkg_path(pkg)
dir.create(file.path(path, "R"))
writeLines('foo <- function() .Call("bar")', file.path(path, "R", "foo.R"))
call_entries <- get_call_entries(path, get_funs(path)$name, get_package_name(path))
# R added `(void)` to the signature after R 4.2.1
expect_match(call_entries[2], "extern SEXP bar[(](void)?[)]")
expect_equal(
get_call_entries(path, get_funs(path)$name, get_package_name(path)),
c("/* .Call calls */",
"extern SEXP bar();",
"",
"static const R_CallMethodDef CallEntries[] = {",
call_entries[4:7],
c("static const R_CallMethodDef CallEntries[] = {",
" {\"bar\", (DL_FUNC) &bar, 0},",
" {NULL, NULL, 0}",
"};"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like longer term we are going to be better off switching all of these to snapshot tests, that way we don't break on CRAN if r-devel changes something. We will get notified by our CI instead and can use the variant argument as needed

Expand Down