1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

fix tests and minor changes

- use the iterator in `CanonPath` to count `level`
- use the `CanonPath::basename` method
- use `CanonPath::root` instead of `CanonPath{""}`
- remove `Path` and `PathView`, use `std::filesystem::path` directly
This commit is contained in:
siddhantCodes 2024-07-03 17:34:02 +05:30
parent 72bb530141
commit 2cf24a2df0
7 changed files with 21 additions and 13 deletions

View file

@ -67,7 +67,7 @@ TEST_F(GitTest, blob_read) {
StringSink out;
RegularFileSink out2 { out };
ASSERT_EQ(parseObjectType(in, mockXpSettings), ObjectType::Blob);
parseBlob(out2, CanonPath{""}, in, BlobMode::Regular, mockXpSettings);
parseBlob(out2, CanonPath::root, in, BlobMode::Regular, mockXpSettings);
auto expected = readFile(goldenMaster("hello-world.bin"));
@ -132,7 +132,7 @@ TEST_F(GitTest, tree_read) {
NullFileSystemObjectSink out;
Tree got;
ASSERT_EQ(parseObjectType(in, mockXpSettings), ObjectType::Tree);
parseTree(out, CanonPath{""}, in, [&](auto & name, auto entry) {
parseTree(out, CanonPath::root, in, [&](auto & name, auto entry) {
auto name2 = std::string{name.rel()};
if (entry.mode == Mode::Directory)
name2 += '/';
@ -227,7 +227,7 @@ TEST_F(GitTest, both_roundrip) {
mockXpSettings);
};
mkSinkHook(CanonPath{""}, root.hash, BlobMode::Regular);
mkSinkHook(CanonPath::root, root.hash, BlobMode::Regular);
ASSERT_EQ(*files, *files2);
}