Git Product home page Git Product logo

Comments (7)

sergey-tihon avatar sergey-tihon commented on May 14, 2024

I guess it is a new side effect of NUnit 3

What we do in the code now:

    [<DebuggerStepThrough>]
    let shouldEqual (expected : 'a) (actual : 'a) =
        Assert.IsTrue((expected = actual), sprintf "Expected: %A\nActual: %A" expected actual)

We need Assert.IsTrue to use F# structural equality here.

@mrakgr Would you like to find a way to pass message string correctly to NUnit 3?

//cc: @rprouse @et1975

from fsunit.

mrakgr avatar mrakgr commented on May 14, 2024

Hmmm...I took a look at Don's blog and it seems structural equality constraints are set directly on the classes. I was also under the impression that structural equality is the default in F# for the relevant types. Does the Assert class need to be modified to use structural equality then? That's an NUnit class written in C# right?

As for your question, right now, I am still getting familiar with testing frameworks like Nunit and I've just figured out that I need to install the adapter to run the tests from the IDE. I'll keep this issue in mind and take a look at what the problem is if nobody else resolved it by then.

from fsunit.

mrakgr avatar mrakgr commented on May 14, 2024

As a preliminary I tested whether this prints out correctly:

[<Test>]
let ``Assert String``() =
    let x = "Asd\nQwe"
    AssertionException(x) |> raise

It does in fact. This means that the string is getting unescaped somewhere inside the assert function. I'll figure out when I get to it.

from fsunit.

mrakgr avatar mrakgr commented on May 14, 2024

I tried building NUnit manually, and I can see that the string prints just fine there both in F# (when I reference the manually built dll from Interactive) and C# (when I convert the .NET 4.5 version to a console app.) So that probably means that either the NUnit package that comes with FsUnit is stale, or if the case is that FsUnit fetches the main one directly from Nuget, then the main one on Nuget is stale.

Could you please check that the NUnit that comes with FsCheck is up to date?

from fsunit.

mrakgr avatar mrakgr commented on May 14, 2024

Nevermind, I've verified that it is the main one on Nuget that is causing the issue.

from fsunit.

sergey-tihon avatar sergey-tihon commented on May 14, 2024

So, here it is nunit/nunit#1575
Will be fixed in NUnit 3.5

from fsunit.

mrakgr avatar mrakgr commented on May 14, 2024

Yes, it will be fixed in the next version. I think I'll close this issue as it have been investigated. If you want to add structural equality constraints, please feel free to open a separate issue for that.

from fsunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.