Skip to content

Commit

Permalink
Finally add tests for jsonrpc id
Browse files Browse the repository at this point in the history
  • Loading branch information
liamsi committed Jun 3, 2020
1 parent 622166b commit 73e3011
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tendermint/src/rpc/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Id>(str);

let str2 = r#""936DA01F-9ABD-4D9D-80C7-02AF85C822A8""#;
test_serialization_roundtrip::<Id>(str2);

let num = r#"42"#;
test_serialization_roundtrip::<Id>(num);

let zero = r#"0"#;
test_serialization_roundtrip::<Id>(zero);

let null = r#"null"#;
test_serialization_roundtrip::<Id>(null);
}
}

0 comments on commit 73e3011

Please sign in to comment.