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

be able to output little prefix strings on failed assertion / comments #99

Open
berndbischl opened this issue Jan 25, 2017 · 1 comment

Comments

@berndbischl
Copy link
Collaborator

sometimes it is really need to inform the the user WHY you are enforcing a certain thing.

i would love to be able to do this

asssertFactor(f, na.ok = FALSE, comment = "'f' shouldnt be NA because bla")

and "comment" is pasted directly before the failed assertion error message.

that would be super useful in many cases to make user feedback better

@PetterHopp
Copy link
Contributor

I support the idea of the possibility to include a comment if the assertation fails. This can be very useful in aiding the user in how to correct their arguments to the functions.
However, I will prefer to have the comment pasted directly after the "standard" message. Then you keep the well-considered way checkmate presents the error messages and the comment is used to explain and help the user.

PetterHopp added a commit to PetterHopp/checkmate that referenced this issue Aug 26, 2021
Included help text for argument 'comment' in assertion functions.
PetterHopp added a commit to PetterHopp/checkmate that referenced this issue Aug 26, 2021
I suggest to include the argument 'comment' in assertion-functions. 
The suggestion appends the comment after the standard message and may be considered as a solution of 
issue mllg#99. The original wish was to place the comment before the standard message.
I have put the argument 'comment' before the argument 'add'. This may be a breaking change if users of the assertion functions has listed the arguments without the argument name, i.e has not used "... , add = collection", but just written (... , collection).
PetterHopp added a commit to PetterHopp/checkmate that referenced this issue Aug 26, 2021
Inclusion of the argument 'comment' in assert to make it in agrement with including the argument 'comment' in other assertion functions. In the case of 'combine = "or"', the comment is placed on a new line. In the case of 'combine = "add"', the comment is appended each assertion that fails and is on the same line. If there are more than one assertion that fails, this is not optimal.
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

No branches or pull requests

2 participants