DotIgnoreIgnoreRuleTest.cs 967 B

123456789101112131415161718192021222324252627282930
  1. using Xunit;
  2. namespace Jellyfin.Server.Implementations.Tests.Library;
  3. public class DotIgnoreIgnoreRuleTest
  4. {
  5. [Fact]
  6. public void Test()
  7. {
  8. var ignore = new Ignore.Ignore();
  9. ignore.Add("SPs");
  10. Assert.True(ignore.IsIgnored("f:/cd/sps/ffffff.mkv"));
  11. Assert.True(ignore.IsIgnored("cd/sps/ffffff.mkv"));
  12. Assert.True(ignore.IsIgnored("/cd/sps/ffffff.mkv"));
  13. }
  14. [Fact]
  15. public void TestNegatePattern()
  16. {
  17. var ignore = new Ignore.Ignore();
  18. ignore.Add("SPs");
  19. ignore.Add("!thebestshot.mkv");
  20. Assert.True(ignore.IsIgnored("f:/cd/sps/ffffff.mkv"));
  21. Assert.True(ignore.IsIgnored("cd/sps/ffffff.mkv"));
  22. Assert.True(ignore.IsIgnored("/cd/sps/ffffff.mkv"));
  23. Assert.True(!ignore.IsIgnored("f:/cd/sps/thebestshot.mkv"));
  24. Assert.True(!ignore.IsIgnored("cd/sps/thebestshot.mkv"));
  25. Assert.True(!ignore.IsIgnored("/cd/sps/thebestshot.mkv"));
  26. }
  27. }