Browse Source

Output text line parser now successfully parses NUnit output containing a carriage return character.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1067 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
a328ef8561
  1. 2
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/OutputTextLineParser.cs
  2. 1
      src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj
  3. 38
      src/Main/Base/Test/OutputTextLineParserTestFixture.cs

2
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/OutputTextLineParser.cs

@ -76,7 +76,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -76,7 +76,7 @@ namespace ICSharpCode.SharpDevelop.Gui
RegexOptions regexOptions = multiline ? RegexOptions.Multiline : RegexOptions.None;
if (lineText != null) {
Match match = Regex.Match(lineText, @"^.*?\sin\s(.*?):line\s(\d*)?$", regexOptions);
Match match = Regex.Match(lineText, @"^.*?\sin\s(.*?):line\s(\d*)?\r?$", regexOptions);
if (match.Success) {
try {

1
src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
<Compile Include="Templates\CategorySortOrderTests.cs" />
<Compile Include="Templates\FileTemplateCategoryComparerTests.cs" />
<Compile Include="WebReferences\HttpAuthenticationHeaderTests.cs" />
<Compile Include="OutputTextLineParserTestFixture.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Project\ICSharpCode.SharpDevelop.csproj">

38
src/Main/Base/Test/OutputTextLineParserTestFixture.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Gui;
using NUnit.Framework;
using System;
namespace ICSharpCode.SharpDevelop.Tests
{
[TestFixture]
public class NUnitOutputParserTestFixture
{
[Test]
public void Multiline()
{
string output = " at NunitFoo.Tests.FooTest.Foo() in c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs:line 22\n";
FileLineReference lineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(output, true);
Assert.AreEqual(lineRef.FileName, "c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs");
Assert.AreEqual(21, lineRef.Line);
Assert.AreEqual(0, lineRef.Column);
}
[Test]
public void MultilineWithCarriageReturn()
{
string output = " at NunitFoo.Tests.FooTest.Foo() in c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs:line 22\r\n";
FileLineReference lineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(output, true);
Assert.AreEqual(lineRef.FileName, "c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs");
Assert.AreEqual(21, lineRef.Line);
Assert.AreEqual(0, lineRef.Column);
}
}
}
Loading…
Cancel
Save