diff options
Diffstat (limited to 'tvix/castore/src/proto/tests')
-rw-r--r-- | tvix/castore/src/proto/tests/directory.rs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tvix/castore/src/proto/tests/directory.rs b/tvix/castore/src/proto/tests/directory.rs index 1e7cdb89c118..26c434ab46c0 100644 --- a/tvix/castore/src/proto/tests/directory.rs +++ b/tvix/castore/src/proto/tests/directory.rs @@ -155,7 +155,7 @@ fn validate_invalid_names() { { let d = Directory { directories: vec![DirectoryNode { - name: "".into(), + name: b"\0"[..].into(), digest: DUMMY_DIGEST.to_vec().into(), size: 42, }], @@ -163,7 +163,7 @@ fn validate_invalid_names() { }; match crate::Directory::try_from(d).expect_err("must fail") { DirectoryError::InvalidName(n) => { - assert_eq!(n.as_ref(), b"") + assert_eq!(n.as_ref(), b"\0") } _ => panic!("unexpected error"), }; @@ -282,7 +282,7 @@ fn validate_sorting() { } } - // "a" exists twice, bad. + // "a" exists twice (same types), bad. { let d = Directory { directories: vec![ @@ -307,6 +307,28 @@ fn validate_sorting() { } } + // "a" exists twice (different types), bad. + { + let d = Directory { + directories: vec![DirectoryNode { + name: "a".into(), + digest: DUMMY_DIGEST.to_vec().into(), + size: 42, + }], + symlinks: vec![SymlinkNode { + name: "a".into(), + target: "b".into(), + }], + ..Default::default() + }; + match crate::Directory::try_from(d).expect_err("must fail") { + DirectoryError::DuplicateName(s) => { + assert_eq!(s.as_ref(), b"a"); + } + _ => panic!("unexpected error"), + } + } + // "a" comes before "b", all good. { let d = Directory { |