示例#1
0
        public bool IsMatch(string name, uint token)
        {
            if (TokensFilter.HasTokens || NameFilter.HasFilters)
            {
                bool match =
                    (TokensFilter.HasTokens && TokensFilter.IsMatch(token)) ||
                    (NameFilter.HasFilters && NameFilter.IsMatch(name));
                if (!match)
                {
                    return(false);
                }
            }

            if (ExcludeTokensFilter.HasTokens || ExcludeNameFilter.HasFilters)
            {
                bool match =
                    (ExcludeTokensFilter.HasTokens && ExcludeTokensFilter.IsMatch(token)) ||
                    (ExcludeNameFilter.HasFilters && ExcludeNameFilter.IsMatch(name));
                if (match)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
        public bool IsMatch(string name, uint token)
        {
            if (TokensFilter.HasTokens || NameFilter.HasFilters)
            {
                bool match =
                    (TokensFilter.HasTokens && TokensFilter.IsMatch(token)) ||
                    (NameFilter.HasFilters && NameFilter.IsMatch(name));
                if (!match)
                {
                    return(false);
                }
            }

            if (IgnoreTokensFilter.HasTokens || IgnoreNameFilter.HasFilters)
            {
                bool match =
                    !((IgnoreTokensFilter.HasTokens && IgnoreTokensFilter.IsMatch(token)) ||
                      (IgnoreNameFilter.HasFilters || IgnoreNameFilter.IsMatch(name)));
                if (!match)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#3
0
 public void NoMatches(string expressionToMatch)
 {
     string someExpression = "A*b+";
     RegexFilter filter = new RegexFilter(new Regex(someExpression));
     Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', None)");
     Assert.IsFalse(filter.IsMatch(expressionToMatch));
 }
示例#4
0
 public void Matches(string expressionToMatch, RegexOptions regexOptions)
 {
     string someExpression = "A*b+";
     RegexFilter filter = new RegexFilter(new Regex(someExpression, regexOptions));
     Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', " + regexOptions + ")");
     Assert.IsTrue(filter.IsMatch(expressionToMatch));
 }
示例#5
0
        public void NoMatches(string expressionToMatch)
        {
            string      someExpression = "A*b+";
            RegexFilter filter         = new RegexFilter(new Regex(someExpression));

            Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', None)");
            Assert.IsFalse(filter.IsMatch(expressionToMatch));
        }
示例#6
0
        public void Matches(string expressionToMatch, RegexOptions regexOptions)
        {
            string      someExpression = "A*b+";
            RegexFilter filter         = new RegexFilter(new Regex(someExpression, regexOptions));

            Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', " + regexOptions + ")");
            Assert.IsTrue(filter.IsMatch(expressionToMatch));
        }
 public void UnnamedGroup()
 {
     var environment = new Environment();
     var filter = new RegexFilter(@"^file(\d+)\.txt$");
     var file = new DummyFile("file456.txt");
     filter.IsMatch(file, environment);
     Assert.AreEqual("456", environment.Get("1"));
 }
        public void UnnamedGroup()
        {
            var environment = new Environment();
            var filter      = new RegexFilter(@"^file(\d+)\.txt$");
            var file        = new DummyFile("file456.txt");

            filter.IsMatch(file, environment);
            Assert.AreEqual("456", environment.Get("1"));
        }