MCPcopy Index your code
hub / github.com/emwalker/digraph / parse_path_works

Function parse_path_works

backend/src/git/client.rs:706–733  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

704
705 #[test]
706 fn parse_path_works() {
707 let result = parse_path("../../12345/12/34/5678/object.yaml");
708 assert!(matches!(result, Err(Error::Repo(_))));
709
710 let (root, repo_id, oid) =
711 parse_path("../../32212616-fc1b-11e8-8eda-b70af6d8d09f/objects/12/34/5678/object.yaml")
712 .unwrap();
713 assert_eq!(root.path, PathBuf::from("../.."));
714 assert_eq!(
715 repo_id.to_string(),
716 "32212616-fc1b-11e8-8eda-b70af6d8d09f".to_owned()
717 );
718 assert_eq!(oid.to_string(), "12345678".to_owned());
719
720 let (root, repo_id, oid) = parse_path(
721 "../../32212616-fc1b-11e8-8eda-b70af6d8d09f/objects/q-/ZZ/meNzLnZvgk_QGVjqPIpSgkADx71iWZrapMTphpQ/object.yaml",
722 )
723 .unwrap();
724 assert_eq!(root.path, PathBuf::from("../.."));
725 assert_eq!(
726 repo_id.to_string(),
727 "32212616-fc1b-11e8-8eda-b70af6d8d09f".to_owned()
728 );
729 assert_eq!(
730 oid.to_string(),
731 "q-ZZmeNzLnZvgk_QGVjqPIpSgkADx71iWZrapMTphpQ".to_owned(),
732 );
733 }
734
735 mod git_paths {
736 use super::*;

Callers

nothing calls this directly

Calls 1

parse_pathFunction · 0.85

Tested by

no test coverage detected