Is.StringMatching() takes a string argument, which is to be used as a
regular expression. Hence, it must be a valid regular expression. You
should either use Is.EqualTo() or escape the ')' like this: @"NUnit is
:\) happy!"
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.
I don't understand. I ran the "TestThatPasses()" method (below) and it passes.
It is the exactly same regular expression. Am I doing something wrong?
[Test]
Encoding encoding = Encoding.Unicode; GetBytes( ExpectedString) ; GetString( bytes);
public void Test_NUnitBug()
{
const string ExpectedString = "NUnit is :) happy!";
byte[] bytes = encoding.
string actualString = encoding.
}
[Test]
Console. WriteLine( ExpectedString) ;
Console. WriteLine( ExpectedString. Length) ;
Assert. That(ExpectedSt ring, Is.StringMatchi ng(ExpectedStri ng));
public void TestThatPasses()
{
const string ExpectedString = "NUnit is :) happy!";
}
-Roberto
----- Mensaje original ---- ing(string) - method
De: Charlie Poole <email address hidden>
Para: <email address hidden>
Enviado: miƩrcoles, 5 de enero, 2011 19:38:48
Asunto: [Bug 697919] Re: Exception in -Is.StringMatch
Is.StringMatching() takes a string argument, which is to be used as a
regular expression. Hence, it must be a valid regular expression. You
should either use Is.EqualTo() or escape the ')' like this: @"NUnit is
:\) happy!"
-- /bugs.launchpad .net/bugs/ 697919
You received this bug notification because you are a direct subscriber
of the bug.
https:/
Title: ing(string) - method
Exception in -Is.StringMatch
Status in NUnit Test Framework:
New
Bug description:
This is my code:
[Test]
Encoding encoding = Encoding.Unicode; GetBytes( ExpectedString) ; GetString( bytes);
public void Test_NUnitBug()
{
const string ExpectedString = "NUnit is :) happy!";
byte[] bytes = encoding.
string actualString = encoding.
}
This is the exception:
NUnit is :) happy!
NUnit is :) happy!
18
18
System. ArgumentExcepti on : parsing "NUnit is :) happy!" - Too many )'s. Text.RegularExp ressions. RegexParser. ScanRegex( ) Text.RegularExp ressions. RegexParser. Parse(String re, RegexOptions op) Text.RegularExp ressions. Regex.. ctor(String pattern, RegexOptions Text.RegularExp ressions. Regex.IsMatch( String input, String pattern, .Constraints. RegexConstraint .Matches( Object actual) .Assert. That(Object actual, IResolveConstraint expression, Test_NUnitBug( ) in MyTest.cs: line 48
at System.
at System.
at System.
options, Boolean useCache)
at System.
RegexOptions options)
at NUnit.Framework
at NUnit.Framework
String message, Object[] args)
at MyCopy.
------
I ran NUnit using the console and ReSharper.
To unsubscribe from this bug, go to: /bugs.launchpad .net/nunit- 3.0/+bug/ 697919/ +subscribe
https:/