Mercurial > hg
changeset 50330:eb07591825fa stable
rhg: show a bug in the rust implementation of path_encode introduced recently
In commit 96d31efd21f7 I did a refactoring where I dropped a chunk
of code by accident, thus introducing a bug.
This commit adds a test demonstrating that bug.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Fri, 24 Mar 2023 19:01:03 +0000 |
parents | 3dbc7b1ecaba |
children | 0b84474ebd0a |
files | rust/hg-core/src/revlog/path_encode.rs |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/path_encode.rs Fri Mar 24 02:22:12 2023 -0400 +++ b/rust/hg-core/src/revlog/path_encode.rs Fri Mar 24 19:01:03 2023 +0000 @@ -610,6 +610,18 @@ use crate::utils::hg_path::HgPathBuf; #[test] + fn test_dirname_ends_with_underscore() { + let input = b"data/dir1234.foo/ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ.i"; + // TODO: BUG: trailing dot should become an underscore + let expected = b"dh/dir1234./abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij.if2e9ce59e095eff5f8f334dc809e65606a0aa50b.i"; + let res = path_encode(input); + assert_eq!( + HgPathBuf::from_bytes(&res), + HgPathBuf::from_bytes(expected) + ); + } + + #[test] fn test_long_filename_at_root() { let input = b"data/ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ.i"; let expected = b"dh/abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij.i708243a2237a7afae259ea3545a72a2ef11c247b.i";