We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
to_string()
1 parent bbcfccc commit 271258dCopy full SHA for 271258d
src/cid.rs
@@ -404,4 +404,20 @@ mod tests {
404
assert!(cid1 != cid2);
405
assert!(!cid2.is_null());
406
}
407
+
408
+ #[test]
409
+ fn test_string_roundtrip() {
410
+ let v1 = Builder::new(Codec::Cidv1)
411
+ .with_target_codec(Codec::DagCbor)
412
+ .with_hash(
413
+ &mh::Builder::new_from_bytes(Codec::Sha3512, b"for great justice, move every zig!")
414
+ .unwrap()
415
+ .try_build()
416
+ .unwrap(),
417
+ )
418
419
+ .unwrap();
420
+ let s = v1.to_string();
421
+ assert_eq!(s, EncodedCid::try_from(s.as_str()).unwrap().to_string());
422
+ }
423
0 commit comments