-
Notifications
You must be signed in to change notification settings - Fork 274
Make split_string check&throw instead of assert return value #3471
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
Make split_string check&throw instead of assert return value #3471
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
throw deserialization_exceptiont{"expected string `" + s + | ||
"' to contain two substrings " | ||
"delimited by " + | ||
delim + " but has " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"but has" -> "but there are" (suggestion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: b68d590).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92679458
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
(Unrelated request, for another PR: This variant should return a std::pair<std::string, std::string>. One day, this will enable these to become std::string_view. |
b68d590
to
4538eaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 4538eaf).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92726576
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
The 2-string version of split_string previously asserted that the split would result in the right number of substrings. That made it not very useful for parsing user input, as using it would require parsing the string before passing it to split_string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
"' to contain two substrings " | ||
"delimited by " + | ||
delim + " but has " + | ||
std::to_string(result.size())}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: " but has " + std::to_string(result.size()) + " substrings"
4538eaf
to
19babdc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 19babdc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92836392
The 2-string version of split_string previously asserted that the split would
result in the right number of substrings. That made it not very useful for
parsing user input, as using it would require parsing the string before passing
it to split_string.