Show More
@@ -643,3 +643,22 b' pub fn path_encode(path: &[u8]) -> Vec<u' | |||||
643 | hash_encode(path) |
|
643 | hash_encode(path) | |
644 | } |
|
644 | } | |
645 | } |
|
645 | } | |
|
646 | ||||
|
647 | #[cfg(test)] | |||
|
648 | mod tests { | |||
|
649 | use super::*; | |||
|
650 | use crate::utils::hg_path::HgPathBuf; | |||
|
651 | ||||
|
652 | // expected failure | |||
|
653 | #[test] | |||
|
654 | #[should_panic] | |||
|
655 | fn test_long_filename_at_root() { | |||
|
656 | let input = b"data/ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ.i"; | |||
|
657 | let expected = b"dh/abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij.i708243a2237a7afae259ea3545a72a2ef11c247b.i"; | |||
|
658 | let res = path_encode(input); | |||
|
659 | assert_eq!( | |||
|
660 | HgPathBuf::from_bytes(&res), | |||
|
661 | HgPathBuf::from_bytes(expected) | |||
|
662 | ); | |||
|
663 | } | |||
|
664 | } |
General Comments 0
You need to be logged in to leave comments.
Login now