# \dontshow{
o <- options(warn=1, useFancyQuotes=FALSE)
# }
g <- function(b=NULL, ...){
invisible(force(b))
}
f <- function(...){
rlang::check_dots_used(error = unused_dots_warning)
g(...)
}
f() # OK
f(b=2) # OK
f(a=1, b=2, c=3) # Warning about a and c but not about b
# \dontshow{
# Test:
stopifnot(grepl("Argument(s) 'a' and 'c' were not recognized or used. Did you mistype an argument name?", tryCatch(f(a=1, b=2, c=3), warning = function(e) e$message), fixed=TRUE))
options(o)
# }
Run the code above in your browser using DataLab