Add error messages to the panic in tests and use should_panic more effectively#66
Merged
Add error messages to the panic in tests and use should_panic more effectively#66
Conversation
6737430 to
953f8c3
Compare
…sage when converting from bauble value to rust fails, and add helper method for writing errors to a string
cbb99ec to
5809124
Compare
Imberflur
commented
Dec 3, 2025
| /// the same. | ||
| /// | ||
| /// Panics if converting object fails. | ||
| pub fn expected_from_bauble<T>( |
Contributor
Author
There was a problem hiding this comment.
I can't reuse this in bauble/tests/integration.rs because this takes the RwLock which I believe needs to be unlocked when calling from_bauble for certain tests (so we can't just take reference to BaubleContext here)
Imberflur
commented
Dec 3, 2025
| } | ||
|
|
||
| /// Writes errors and attempts to convert them to a string. | ||
| pub fn try_to_string(&self, ctx: &BaubleContext) -> Result<String, std::string::FromUtf8Error> { |
Contributor
Author
There was a problem hiding this comment.
Not sure if this can ever fail, but I wanted to keep any potential panicking out the main bauble API. So this returns a result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #59
This is also used in a test in my upcoming changes.
I haven't observed any issue with treating the bytes from
write_errorsas utf8.