MCPcopy Create free account
hub / github.com/git/git / object_ids_format_correctly

Function object_ids_format_correctly

src/hash.rs:396–433  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394
395 #[test]
396 fn object_ids_format_correctly() {
397 let entries = &[
398 (
399 HashAlgorithm::SHA1.null_oid(),
400 "0000000000000000000000000000000000000000",
401 "0000000000000000000000000000000000000000:sha1",
402 ),
403 (
404 HashAlgorithm::SHA1.empty_blob(),
405 "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
406 "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:sha1",
407 ),
408 (
409 HashAlgorithm::SHA1.empty_tree(),
410 "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
411 "4b825dc642cb6eb9a060e54bf8d69288fbee4904:sha1",
412 ),
413 (
414 HashAlgorithm::SHA256.null_oid(),
415 "0000000000000000000000000000000000000000000000000000000000000000",
416 "0000000000000000000000000000000000000000000000000000000000000000:sha256",
417 ),
418 (
419 HashAlgorithm::SHA256.empty_blob(),
420 "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813",
421 "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813:sha256",
422 ),
423 (
424 HashAlgorithm::SHA256.empty_tree(),
425 "6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321",
426 "6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321:sha256",
427 ),
428 ];
429 for (oid, display, debug) in entries {
430 assert_eq!(format!("{}", oid), *display);
431 assert_eq!(format!("{:?}", oid), *debug);
432 }
433 }
434
435 #[test]
436 fn hasher_works_correctly() {

Callers

nothing calls this directly

Calls 3

null_oidMethod · 0.80
empty_blobMethod · 0.80
empty_treeMethod · 0.80

Tested by

no test coverage detected