Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Underscore in string creates accelerator in the code editor NCrunch tooltip text
KVirkus
#1 Posted : Monday, May 6, 2019 1:25:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/6/2019(UTC)
Posts: 3
Location: Germany

NCrunch is a great tool. However, I wanted to report a cosmetical issue when showing NCrunch details of a single line in the text editor. Unfortunately, attaching an image to this post is unnecessarily complex (I cannot just serve an image on the web) so I will try to describe on how to reproduce and what the effect looks like.


Steps to reproduce:
  • Write a unit test that calls a method with a string argument including an underscore character followed by any alphanumerical character; example:
    Quote:
    sut.Validate("abc_def").Should().BeTrue();

  • Make the test fail on the line, the method gets called (here by making "Validate" return false)

  • With the mouse cursor click on or hover over the VS code editor border over the NCrunch red cross signalling that a test has failed at this line


Observation:
In the popup/tooltip window, the expectation of the unit test assertion is printed. Here the underscore character is no longer printed separately but underlines the following character (here: abcdef) just as known from UI accelerators.


I'm running Visual Studio 15.9.10 Professional, NCrunch 3.22.0.1, NUnit 3.11.0, NUnitTestAdapter 3.11.2, and FluentAssertions 5.5.3 on a German Windows 10 1809 with US English UI, German locale and Visual Studio in English.

Cheers and keep up the good work,
Kristian
Remco
#2 Posted : Monday, May 6, 2019 9:14:27 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

I think this may be a localisation issue of some kind. Are you able to let me know which culture/language code you have active inside your IDE?
KVirkus
#3 Posted : Tuesday, May 7, 2019 5:48:09 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/6/2019(UTC)
Posts: 3
Location: Germany

Hi Remco,

I have edited my original post concerning the languages and here's some output from the Visual Studio C# Interactive Console:

> System.Globalization.CultureInfo.CurrentCulture
[de-DE]
> System.Globalization.CultureInfo.CurrentUICulture
[en-GB]
> System.Globalization.CultureInfo.InstalledUICulture
[de-DE]

Cheers
michaelkroes
#4 Posted : Tuesday, May 7, 2019 7:40:56 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
I’ve tried reproducing this by setting my local to be similar to yours. I can’t get it to behave that way.

Would it be possible for you to submit a small sample that behaves this way via email? You can send it to michael at ncrunch dot net.
KVirkus
#5 Posted : Tuesday, May 7, 2019 11:40:36 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/6/2019(UTC)
Posts: 3
Location: Germany

I've made a mistake: it's not an underscore character in the assertion string but an ampersand. An underlined character following the ampersand character is just the effect.

Stripped down to not using FluentAssertions but plain NUnit Assert, this is the simplest test I could write reproducing the effect, Class1.cs:

Quote:
using FluentAssertions;
using NUnit.Framework;

namespace NCrunchRepro1
{
public class Class1
{
[Test]
public void Test()
{
Assert.AreEqual("x&y", null);
}
}
}


The output in the tooltip is then: Expected: "xy"

Hope this helps. I'm willing to send anybody an email with a screenshot of the effect.

Maybe someone can change the post's title to reflect the ampersand instead of the underscore character.

Cheers!
michaelkroes
#6 Posted : Tuesday, May 7, 2019 12:46:38 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Thanks for the update!

I don't get the underscore under the next character, but I don't see the ampersand either. I'll will create a task for us to fix this!
michaelkroes
#7 Posted : Tuesday, May 7, 2019 1:49:35 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Thanks for being so helpful! This will be fixed in the next release.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.045 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download