Skip to content

Commit

Permalink
fix: nested classes report UnknownNamespace.UnknownMethod (#41)
Browse files Browse the repository at this point in the history
Updated regex to handle nested class scenario as classes use + as a
separator
Added test case
  • Loading branch information
pageyboy committed Sep 17, 2023
1 parent 6eb1221 commit c26414c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TestLogger/Core/TestCaseNameParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TestCaseNameParser
/// <summary>
/// This one can handle standard formatting with or without method data.
/// </summary>
private static readonly Regex MethodRegex = new (@"^([a-z0-9_.]{1,})\.([a-z0-9_.]{1,})\.(.{1,})$", RegexOptions);
private static readonly Regex MethodRegex = new (@"^([a-z0-9_.]{1,})\.([a-z0-9_.+]{1,})\.(.{1,})$", RegexOptions);

/// <summary>
/// Can handle standard formatting with class and method data.
Expand Down
3 changes: 3 additions & 0 deletions test/TestLogger.UnitTests/TestCaseNameParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class TestCaseNameParserTests
[DataRow("z.y.x.ape.bar('\\'',False)", "z.y.x", "ape", "bar('\\'',False)")]
[DataRow("z.y.x.ape.bar('\\\\',False)", "z.y.x", "ape", "bar('\\\\',False)")]

// See xunit.testlogger #48
[DataRow("z.y+a.x", "z", "y+a", "x")]

// Strip out any line breaks
[DataRow("z.y.x.ape.bar('aa\r\nbb',False)", "z.y.x", "ape", "bar('aabb',False)")]
[DataRow("z.y.x.ape.bar('aa\nbb',False)", "z.y.x", "ape", "bar('aabb',False)")]
Expand Down

0 comments on commit c26414c

Please sign in to comment.