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

checkChoice / assertChoice messages with large set of choices #266

Open
antalk2 opened this issue Aug 19, 2024 · 0 comments
Open

checkChoice / assertChoice messages with large set of choices #266

antalk2 opened this issue Aug 19, 2024 · 0 comments

Comments

@antalk2
Copy link

antalk2 commented Aug 19, 2024

The output of

x="a"; checkmate::assertChoice( x, paste0(LETTERS, 1:1000  ))

is both long and truncated in a way that the closing of the set and
the value of x (}, but is 'a'.) is not shown.

The following patch modifies set_collapse() to limit its result to 80 characters
by replacing the middle part with "...". (Added the .txt extension to make github
to accept the attachment)

0001-set_collapse-witdh-80L.patch.txt

  • + This would make the messages affected more readable.
  • - Adds package 'stringr' as a dependency.
    • This could be reduced.

The following patch (to be applied on top of the above) removes the dependency
on stringr. Includes a modified copy of stringr::str_trunc() (using nchar() and substr())

0002-include-modified-copy-of-stringr-str_trunc.patch.txt

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

1 participant