rust/hg-core/src/revlog/path_encode.rs
changeset 50147 362fe34702d5
parent 50003 e98fd81bb151
child 50148 06659dea51b0
equal deleted inserted replaced
50146:1cffc156f7cd 50147:362fe34702d5
   641         }
   641         }
   642     } else {
   642     } else {
   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 }