Skip to content

Fix xUnit & MsTest message when exception will be thrown inside lambda.#216

Merged
CaptnCodr merged 1 commit intofsprojects:masterfrom
CaptnCodr:bugfix/214-lambda-throws
Sep 7, 2022
Merged

Fix xUnit & MsTest message when exception will be thrown inside lambda.#216
CaptnCodr merged 1 commit intofsprojects:masterfrom
CaptnCodr:bugfix/214-lambda-throws

Conversation

@CaptnCodr
Copy link
Member

@CaptnCodr CaptnCodr commented Sep 1, 2022

This fixes the output message described in #214.

MsTest message was:

Message: 
    FsUnit.Test.TestException "help" was <fun:Pipe #1 input at line 80@80>
Stack Trace: 
    raise tests.Test raising exception with message() line 81

is now e.g.:

Message: 
    FsUnit.Test.TestException "help" was "System.Exception: help
        at <StartupCode$FsUnit-MsTest-Test>.$RaiseTests.Pipe #1 input at line 80@80.Invoke(Unit unitVar0) in C:\Users\const\github\repos\FsUnit\tests\FsUnit.MsTest.Test\raiseTests.fs:line 80
        at FsUnit.Test.raise tests.Test raising exception with message() in C:\Users\const\github\repos\FsUnit\tests\FsUnit.MsTest.Test\raiseTests.fs:line 81"

Stack Trace: 
    raise tests.Test raising exception with message() line 81

xUnit message was:

Message: 
    FsUnit.Xunit+MatchException : Exception of type 'FsUnit.Xunit+MatchException' was thrown.
    Expected: FsUnit.Test.TestException "help"
    Actual:   <fun:Pipe #1 input at line 79@79>

Stack Trace: 
    That.Static[a](a actual, IMatcher`1 matcher) line 28
    raise tests.Test raising exception with message() line 80

is now e.g.:

Message: 
    FsUnit.Xunit+MatchException : Exception of type 'FsUnit.Xunit+MatchException' was thrown.
    Expected: FsUnit.Test.TestException "help"
    Actual:   System.Exception: help
                at <StartupCode$FsUnit-Xunit-Test>.$RaiseTests.Pipe #1 input at line 79@79.Invoke(Unit unitVar0) in C:\Users\const\github\repos\FsUnit\tests\FsUnit.Xunit.Test\raiseTests.fs:line 79
                at FsUnit.Xunit.Assert.That.Static[a](a actual, IMatcher`1 matcher) in C:\Users\const\github\repos\FsUnit\src\FsUnit.Xunit\FsUnit.fs:line 22

Stack Trace: 
    That.Static[a](a actual, IMatcher`1 matcher) line 26
    raise tests.Test raising exception with message() line 80

Beyond that, I refactored operator equalWithin a bit because of that comment above that function

Edit: the output of NUnit is not affected by this change, this is already covered by the NUnit.Framework.

@CaptnCodr
Copy link
Member Author

@sergey-tihon Do you have any corrections/suggestions here? 🙂

@sergey-tihon
Copy link
Member

no, looks good to me.
Thank you for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants