Skip to content
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

Warn for empty arguments to rxRename (and anything using .quoteCallInfoLines() #693

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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# rxode2 (development version)

## New feaures

- Empty arguments to `rxRename()` give a warning (#688)

# rxode2 2.1.3

## Bug fixes
Expand Down
6 changes: 5 additions & 1 deletion R/piping.R
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@
}
}
.quoted <- eval(call("quote", callInfo[[i]]))
if (length(.quoted) == 1) {
if (missing(.quoted)) {
# Capture empty arguments (rxode2#688)
warning("empty argument ignored")
return(NULL)
} else if (length(.quoted) == 1) {
.bracket[i] <- TRUE
assign(".bracket", .bracket, envir=.env)
} else if (identical(.quoted[[1]], quote(`{`)) ||
Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/test-piping-ini.R
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,23 @@ if (!.Call(`_rxode2_isIntel`)) {

})
}

test_that("empty arguments to rxRename() give a warning (#688)", {
mod1 <- function() {
ini({
Kin=1
})
model({
eff <- Kin
})
}

expect_warning(
rxRename(mod1, ),
"empty argument ignored"
)
expect_warning(
rxRename(mod1, foo = eff, ),
"empty argument ignored"
)
})
Loading