Skip to content
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

Backslashes in subject or expected result are not correctly shown in the message #986

Closed
rubenrorije opened this issue Dec 30, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@rubenrorije
Copy link

commented Dec 30, 2018

Description

It seems that when running a test on a string variable backslashes are escaped incorrectly. Especially trailing backslashes are removed from the message.

Complete minimal example reproducing the issue

See multiple unit tests in this gist: https://gist.github.com/rubenrorije/2caf183ffb7e598546d220797252795c

One of the examples of the unit tests:

[TestMethod]
public void Trailing_Backslash_In_Expected_Result_Should_Not_Be_Removed()
{
    "A".Should().Be("A\\");
    /*
     * Output:
     * Expected string to be "A" with a length of 2, but "A" has a length of 1, differs near "A" (index 0).
     * Expected Output:
     * Expected string to be "A\" with a length of 2, but "A" has a length of 1, differs near "A" (index 0).
     */
}

Versions

Fluent Assertions 5.5.3
.Net Framework 4.6.1

Remarks

I would have looked for myself whether this was something that I could solve myself and include a pull-request. But at the moment (travelling in Iran) I do not have reliable internet connection to do this.
Either someone else can take a look, or when I have the opportunity I will look into it more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.