← Back to team overview

nunit-core team mailing list archive

[Bug 697919] Re: Exception in -Is.StringMatching(string)- method

 

Although this is a user error, it's clear that Is.StringMatching isn't the best name for
this. I'll target the bug at NUnit 3.0, where we can find a better syntax.

** Project changed: nunitv2 => nunit-3.0

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/697919

Title:
  Exception in -Is.StringMatching(string)- method

Status in NUnit Test Framework:
  New

Bug description:
  This is my code:

        [Test]
        public void Test_NUnitBug()
        {
            const string ExpectedString = "NUnit is :) happy!";
            Encoding encoding = Encoding.Unicode;
            byte[] bytes = encoding.GetBytes(ExpectedString);
            string actualString = encoding.GetString(bytes);

            Console.WriteLine(actualString);
            Console.WriteLine(ExpectedString);
            Console.WriteLine(actualString.Length);
            Console.WriteLine(ExpectedString.Length);
            Assert.That(actualString, Is.StringMatching(ExpectedString));
        }

This is the exception:

NUnit is :) happy!
NUnit is :) happy!
18
18

System.ArgumentException : parsing "NUnit is :) happy!" - Too many )'s.
at System.Text.RegularExpressions.RegexParser.ScanRegex()
at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern, RegexOptions options)
at NUnit.Framework.Constraints.RegexConstraint.Matches(Object actual)
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at MyCopy.Test_NUnitBug() in MyTest.cs: line 48 


------
I ran NUnit using the console and ReSharper.





References