Skip to content

Args validation checks#117

Merged
tdhock merged 11 commits intomasterfrom
args-validation-checks
Feb 12, 2024
Merged

Args validation checks#117
tdhock merged 11 commits intomasterfrom
args-validation-checks

Conversation

@siddhesh195
Copy link
Copy Markdown
Contributor

Follow up to PR116

Added my name as contributor in DESCRIPTION
Increased version
Added a NEWS item
Added a fix for empty animint() and a test. I missed to commit the test first and will do it from the next time.

Comment thread R/z_print.R Outdated

# Check if argument list is empty
if(length(L) == 0) {
stop(paste("No arguments passed to animint"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you please make the error message more informative? Please tell the user how to fix the problem.
something like "No arguments passed to animint, but arguments should be ggplots (1 or more) and options (0 or more)"
Also please remove paste as it is not necessary.

Copy link
Copy Markdown
Collaborator

@tdhock tdhock left a comment

Choose a reason for hiding this comment

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

good start, please address comments and then I will merge.

Comment thread tests/testthat/test-compiler-errors.R Outdated
})

test_that("animint() is an error", {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please remove empty line inside test_that block.
empty lines like this make it more difficult to run the whole block of code interactively. (that can be done with C-c C-c in emacs, etc)

Comment thread tests/testthat/test-compiler-errors.R Outdated
test_that("animint() is an error", {
expect_error({
animint()
}, "No arguments passed to animint. Arguments should include ggplot(1 or more) and options(0 or more)")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the old version is more correct english (although I would say ggplots instead of ggplot), can you please revert?
why did you make this change?
did you know about expect_error(something, "message", fixed=TRUE) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted the error message to the old one and used fixed=TRUE. I made this change because I thought it would be better to avoid '()' in the error message sentence. I had used escape qualifiers to do the pattern matching in the test and didn't know about fixed=TRUE !

Use fixed=TRUE instead of escape sequence
@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented Feb 12, 2024

looks great thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants