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

Add unit test for currency serialization/deserialization #256

Merged
merged 1 commit into from
Jun 6, 2019

Conversation

woshilapin
Copy link
Contributor

No description provided.

src/utils.rs Outdated Show resolved Hide resolved
@woshilapin woshilapin force-pushed the serde_currency branch 2 times, most recently from 6386a98 to 0574b9f Compare June 4, 2019 06:18
src/utils.rs Outdated
fn test_de_invalid_currency_code() {
let result: Result<CurrencyCodeWrapper, _> =
serde_json::from_str("{\"currency_code\":\"XXX\"}");
let err_msg = result.err().unwrap().to_string();
Copy link
Member

Choose a reason for hiding this comment

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

let err_msg = result.unwrap_err();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I missed that one and it makes sense. Funny fact though, when I did change it, it complains because CurrencyWrapper does not implements std::fmt::Debug. The reason is because .unwrap_err() will panic with the value if the result is of type Ok(). I did the change in 62a3702.

@datanel datanel changed the title ND-255 - Add unit test for currency serialization/deserialization Add unit test for currency serialization/deserialization Jun 5, 2019
src/utils.rs Outdated
#[cfg(test)]
mod tests {

#[cfg(feature = "fare-v2")]
Copy link
Contributor

@ArnaudOggy ArnaudOggy Jun 6, 2019

Choose a reason for hiding this comment

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

You can remove this line now (feature) ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 487f3d0.

@ArnaudOggy ArnaudOggy merged commit fca2b12 into hove-io:fare-v2 Jun 6, 2019
@woshilapin woshilapin deleted the serde_currency branch July 1, 2019 07:28
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.

None yet

3 participants