From 73e30116c5cf0b1f2926ddc01e742463d10b656d Mon Sep 17 00:00:00 2001 From: Ismail Khoffi Date: Wed, 3 Jun 2020 14:35:28 +0200 Subject: [PATCH 1/2] Finally add tests for jsonrpc id --- tendermint/src/rpc/id.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tendermint/src/rpc/id.rs b/tendermint/src/rpc/id.rs index 0e0f6f471..e6c16b2a6 100644 --- a/tendermint/src/rpc/id.rs +++ b/tendermint/src/rpc/id.rs @@ -29,3 +29,27 @@ impl Id { Id::Str(uuid.to_string()) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::test::test_serialization_roundtrip; + + #[test] + fn round_tripping_id() { + let str = r#""42""#; + test_serialization_roundtrip::(str); + + let str2 = r#""936DA01F-9ABD-4D9D-80C7-02AF85C822A8""#; + test_serialization_roundtrip::(str2); + + let num = r#"42"#; + test_serialization_roundtrip::(num); + + let zero = r#"0"#; + test_serialization_roundtrip::(zero); + + let null = r#"null"#; + test_serialization_roundtrip::(null); + } +} From e07e09351d1619890b9c42cdc38d55a2c2581d76 Mon Sep 17 00:00:00 2001 From: Ismail Khoffi Date: Wed, 3 Jun 2020 17:01:57 +0200 Subject: [PATCH 2/2] rename according to review --- tendermint/src/rpc/id.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tendermint/src/rpc/id.rs b/tendermint/src/rpc/id.rs index e6c16b2a6..9d94d496f 100644 --- a/tendermint/src/rpc/id.rs +++ b/tendermint/src/rpc/id.rs @@ -36,7 +36,7 @@ mod tests { use crate::test::test_serialization_roundtrip; #[test] - fn round_tripping_id() { + fn round_tripping_jsonrpc_id() { let str = r#""42""#; test_serialization_roundtrip::(str);