aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs
blob: d677c9f0911bca9ce4d5ee5981a1759bf86e809d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Xunit;

namespace Jellyfin.Server.Implementations.Tests.Library;

public class DotIgnoreIgnoreRuleTest
{
    [Fact]
    public void Test()
    {
        var ignore = new Ignore.Ignore();
        ignore.Add("SPs");
        Assert.True(ignore.IsIgnored("f:/cd/sps/ffffff.mkv"));
        Assert.True(ignore.IsIgnored("cd/sps/ffffff.mkv"));
        Assert.True(ignore.IsIgnored("/cd/sps/ffffff.mkv"));
    }

    [Fact]
    public void TestNegatePattern()
    {
        var ignore = new Ignore.Ignore();
        ignore.Add("SPs");
        ignore.Add("!thebestshot.mkv");
        Assert.True(ignore.IsIgnored("f:/cd/sps/ffffff.mkv"));
        Assert.True(ignore.IsIgnored("cd/sps/ffffff.mkv"));
        Assert.True(ignore.IsIgnored("/cd/sps/ffffff.mkv"));
        Assert.True(!ignore.IsIgnored("f:/cd/sps/thebestshot.mkv"));
        Assert.True(!ignore.IsIgnored("cd/sps/thebestshot.mkv"));
        Assert.True(!ignore.IsIgnored("/cd/sps/thebestshot.mkv"));
    }
}