This repository has been archived by the owner on Dec 12, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Causes issues with xml serialisation of messages between ReSharper and the external test runner. This was already handled by xunit1, since it used xml to serialise between AppDomains. Serialises interfaces and raw strings now, so no longer needs to escape strings. Fixes #10
- Loading branch information
1 parent
3bd4d2b
commit 34b685e
Showing
8 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
resharper/src/xunitcontrib.runner.resharper.runner/DisplayNameUtil.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Text; | ||
|
||
namespace XunitContrib.Runner.ReSharper.RemoteRunner | ||
{ | ||
public class DisplayNameUtil | ||
{ | ||
public static string Escape(string name) | ||
{ | ||
var sb = new StringBuilder(); | ||
foreach (var c in name) | ||
sb.Append(EscapeControlChar(c)); | ||
|
||
return sb.ToString(); | ||
} | ||
|
||
private static string EscapeControlChar(char c) | ||
{ | ||
switch (c) | ||
{ | ||
case '\0': | ||
return "\\0"; | ||
case '\a': | ||
return "\\a"; | ||
case '\b': | ||
return "\\b"; | ||
case '\f': | ||
return "\\f"; | ||
case '\n': | ||
return "\\n"; | ||
case '\r': | ||
return "\\r"; | ||
case '\t': | ||
return "\\t"; | ||
case '\v': | ||
return "\\v"; | ||
|
||
case '\x0085': | ||
case '\x2028': | ||
case '\x2029': | ||
return string.Format("\\x{0:X4}", (ushort)c); | ||
|
||
default: | ||
return char.IsControl(c) || (ushort)c > 128 | ||
? String.Format("\\x{0:X4}", (ushort)c) | ||
: c.ToString(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
resharper/test/data/Runner/Gold/EscapedDataAttributeStrings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Foo | ||
{ | ||
public class PassingTheory | ||
{ | ||
[Theory] | ||
[InlineData("$ \\ \b \f \n \r \t \v")] | ||
public void TestMethod(string value) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
// xunit2 doesn't define Xunit.Extensions | ||
namespace Xunit.Extensions | ||
{ | ||
} |
14 changes: 14 additions & 0 deletions
14
resharper/test/data/Runner/Gold/EscapedDataAttributeStrings.xunit1.dll.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<task-start /> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" /></task-start> | ||
<cache-folder /> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /></task-start> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /></task-start> | ||
<task-create><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \x8 \xC \n \r \t \xB")" /></task-create> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \x8 \xC \n \r \t \xB")" /></task-start> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \x8 \xC \n \r \t \xB")" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \x8 \xC \n \r \t \xB")" /><message /></task-finish> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /><message /></task-finish> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /><message /></task-finish> | ||
<task-finish result="Success" /> |
14 changes: 14 additions & 0 deletions
14
resharper/test/data/Runner/Gold/EscapedDataAttributeStrings.xunit2.dll.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<task-start /> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" /></task-start> | ||
<cache-folder /> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /></task-start> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /></task-start> | ||
<task-create><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \b \f \n \r \t \v")" /></task-create> | ||
<task-start><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \b \f \n \r \t \v")" /></task-start> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \b \f \n \r \t \v")" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" TheoryName="TestMethod(value: "$ \ \b \f \n \r \t \v")" /><message /></task-finish> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" MethodName="TestMethod" Explicitly="False" Dynamic="False" /><message /></task-finish> | ||
<task-duration><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /></task-duration> | ||
<task-finish result="Success"><task runnerID="xUnit" ProjectId="697F5F53-AEB2-4284-AA79-90E7368C55E6" TypeName="Foo.PassingTheory" Explicitly="False" /><message /></task-finish> | ||
<task-finish result="Success" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters