New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eventlistener will no longer send single spaces when the test output … #523
Conversation
…is empty or just whitespace #516
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be easy to write a test that creates an NUnitEventListener
and processes test results with whitespace and non-whitespace output and verifies that _recorder.SendMessage is only called for only the appropriate outputs?
namespace NUnit.VisualStudio.TestAdapter.Internal | ||
{ | ||
#if NET35 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: empty line between the #if
and the class, but no empty line between the #endif
and either class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed empty line
var site = resultNode.GetAttribute("site"); | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super silly nitpick: new whitespace added to this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happens when a new line is inserted and spaces are default :-(
@@ -180,22 +178,21 @@ public void SuiteFinished(XmlNode resultNode) | |||
|
|||
private static readonly string NL = Environment.NewLine; | |||
private static readonly int NL_LENGTH = NL.Length; | |||
private IDumpXml dumpXml; | |||
private readonly IDumpXml dumpXml; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see the cleanup in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{ | ||
public static bool IsNullOrWhiteSpace(this string value) | ||
{ | ||
return value == null || value.Trim().Length == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to stay simple since it's not in a hot path. 👍
For comparison: https://referencesource.microsoft.com/#mscorlib/system/string.cs,55e241b6143365ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just used the https://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace(v=vs.110).aspx as a reference, and under remarks this code is shown as equivalent, and it is easier than the code from the referencesource.
[TestCase(" \t")] | ||
[TestCase(" ")] | ||
[TestCase("")] | ||
public void ThatIsNullOrWhiteSpaceHandlesTabs(string value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all of these cases are related to handling tabs. Also can we have [TestCase(null)]
and [TestCase("\r\n")]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
namespace NUnit.VisualStudio.TestAdapter.Tests | ||
{ | ||
#if !NETCOREAPP1_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be running these tests on netcoreapp1.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@"<test-output stream='Progress' testid='0-1001' testname='Something.TestClass.Whatever'><![CDATA[Whatever | ||
]]></test-output>"; | ||
|
||
private const string BlankTestoutput = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For both these fields, I think you'd capitalize the O since it's two words.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with suggestion.
Seems there is some build issues with the test project running NSubstitute...... got to look at that before merging. |
@@ -4,7 +4,8 @@ | |||
<PropertyGroup> | |||
<RootNamespace>NUnit.VisualStudio.TestAdapter.Tests</RootNamespace> | |||
<AssemblyName>NUnit.VisualStudio.TestAdapter.Tests</AssemblyName> | |||
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks> | |||
<TargetFrameworks>net35;netcoreapp1.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OsirisTerje Changing net46 to net35 is what is causing the NuGet restore failures. Any reason not to use net46
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste error when I reverted back from debugging this. It is very annoying that VS don't really work with multiple targets, so I always remove the .netcore one......., just my way.....
…is empty or just whitespace #516
The eventlistener will not send anything if the test output is null, empty or just consists of whitespaces