1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 22:20:59 +01:00

Re-introduce git_attr_get_ext

This commit is contained in:
Leandro Reina 2024-12-18 18:00:45 +01:00
parent 140b34b7ed
commit b1663fa3fb
3 changed files with 32 additions and 233 deletions

View file

@ -235,44 +235,6 @@ TEST_F(GitUtilsTest, gitUrlToSsh)
}
}
class FetchAttributeTest : public ::testing::Test
{
protected:
void SetUp() override
{
// test literal (non-wildcard) matches too
std::string content1 = "litfile filter=lfs diff=lfs merge=lfs -text";
auto rules1 = parseGitAttrFile(content1);
fetch1.rules = std::move(rules1);
std::string content2 = "*.wildcard filter=lfs diff=lfs merge=lfs -text";
auto rules2 = parseGitAttrFile(content2);
fetch2.rules = std::move(rules2);
}
Fetch fetch1;
Fetch fetch2;
};
TEST_F(FetchAttributeTest, ExactMatch)
{
EXPECT_TRUE(fetch1.hasAttribute("litfile", "filter", "lfs"));
EXPECT_FALSE(fetch1.hasAttribute("other", "filter", "lfs"));
}
TEST_F(FetchAttributeTest, WildcardMatch)
{
EXPECT_TRUE(fetch2.hasAttribute("match.wildcard", "filter", "lfs"));
EXPECT_FALSE(fetch2.hasAttribute("nomatch.otherext", "filter", "lfs"));
EXPECT_FALSE(fetch2.hasAttribute("nomatch.wildcard.extra", "filter", "lfs"));
}
TEST_F(FetchAttributeTest, EmptyPath)
{
EXPECT_FALSE(fetch1.hasAttribute("", "filter", "lfs"));
EXPECT_FALSE(fetch2.hasAttribute("", "filter", "lfs"));
}
} // namespace lfs
} // namespace nix