Skip to content

Restore existing test comments and keep variadic assertion tests#145

Merged
selkamand merged 1 commit intomainfrom
codex/add-function-to-assert-variable-argument-support
Feb 9, 2026
Merged

Restore existing test comments and keep variadic assertion tests#145
selkamand merged 1 commit intomainfrom
codex/add-function-to-assert-variable-argument-support

Conversation

@selkamand
Copy link
Owner

Motivation

  • Restore test commentary that was accidentally removed while adding the variadic assertion, preserving package test documentation and style.

Description

  • Restored existing descriptive comments in tests/testthat/test-assert_functions.R while preserving the new per-expectation comments and blank-line formatting for the assert_function_variadic() block.
  • Kept the previously added variadic assertion implementation and artifacts including function_variadic_advanced() in R/assert_functions.R, the exported assert_function_variadic in NAMESPACE, man/assert_function_variadic.Rd, and the NEWS.md entry.
  • Committed the updated tests so test descriptions are consistent and readable without changing existing test logic.

Testing

  • Ran devtools::document() successfully with updated documentation generated.
  • Ran devtools::test() and all tests passed ([ FAIL 0 | WARN 0 | SKIP 0 | PASS 995 ]).
  • Ran devtools::check() which completed with 0 errors, 0 warnings and 1 NOTE (unable to verify current time).

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17427422c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +32
function_variadic_advanced <- function(x){
if(!is.function(x))
return("{.strong '{arg_name}'} must be a function, not a {class(arg_value)}")

if(!func_supports_variable_arguments(x))
return("{.strong '{arg_name}'} must accept variable arguments via {.strong ...}")

Choose a reason for hiding this comment

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

P2 Badge Treat primitives with NULL args() as variadic

assert_function_variadic() relies on func_supports_variable_arguments(), which in turn inspects names(formals(args(func))). For several base primitives (e.g., subsetting [/[[), args() returns NULL even though the function accepts ..., so this check returns FALSE and the new assertion incorrectly fails for genuinely variadic primitives. This means callers trying to assert variadic behavior on such primitives will get a false negative. Consider a fallback that treats args(func) == NULL differently (or a different detection strategy) so primitives with undocumented signatures aren’t misclassified.

Useful? React with 👍 / 👎.

@selkamand selkamand linked an issue Feb 9, 2026 that may be closed by this pull request
@selkamand selkamand merged commit a3b84c8 into main Feb 9, 2026
7 checks passed
@selkamand selkamand deleted the codex/add-function-to-assert-variable-argument-support branch February 9, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assert_function_supports_variable_arguments(func)

1 participant