Ejemplo n.º 1
0
            private void VerifyReplace(VimRegexOptions options, string pattern, string input, string replace, string result)
            {
                var regex = VimRegexFactory.Create(pattern, options);

                Assert.True(regex.IsSome());

                var noMagic     = VimRegexOptions.NoMagic == (options & VimRegexOptions.NoMagic);
                var replaceData = new VimRegexReplaceData(Environment.NewLine, !noMagic, VimRegexReplaceCount.All);

                Assert.Equal(result, regex.Value.Replace(input, replace, replaceData));
            }
Ejemplo n.º 2
0
        private void VerifyNotMatches(VimRegexOptions options, string pattern, params string[] inputArray)
        {
            var opt = VimRegexFactory.Create(pattern, options);

            Assert.True(opt.IsSome());
            var regex = opt.Value;

            foreach (var cur in inputArray)
            {
                Assert.False(regex.IsMatch(cur));
            }
        }
Ejemplo n.º 3
0
        private void VerifyMatchesAt(VimRegexOptions options, string pattern, string input, params Tuple <int, int>[] spans)
        {
            var opt = VimRegexFactory.Create(pattern, options);

            Assert.True(opt.IsSome());
            var regex   = opt.Value;
            var matches = regex.Regex.Matches(input);
            var count   = matches.Cast <object>().Count();

            Assert.Equal(count, spans.Length);
            for (int i = 0; i < count; i++)
            {
                var position = spans[i].Item1;
                var length   = spans[i].Item2;
                var match    = matches[i];
                Assert.Equal(position, match.Index);
                Assert.Equal(length, match.Length);
            }
        }
Ejemplo n.º 4
0
        private static void VerifyRegex(VimRegexOptions options, string vimPattern, string regexPattern)
        {
            var vimRegex = VimRegexFactory.Create(vimPattern, options).AssertSome();

            Assert.Equal(regexPattern, vimRegex.RegexPattern);
        }
Ejemplo n.º 5
0
 private FSharpOption <VimRegex> Create(string pattern)
 {
     return(VimRegexFactory.CreateForSettings(pattern, _globalSettings));
 }
Ejemplo n.º 6
0
 public void Setup()
 {
     _settings = new Vim.GlobalSettings();
     _settings.IgnoreCase = true;
     _settings.SmartCase = false;
     _factory = new VimRegexFactory(_settings);
 }