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

Bump Akka.TestKit from 1.5.33 to 1.5.34 #160

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

milang
Copy link
Contributor

@milang milang commented Jan 7, 2025

Changes

Bumps Akka.TestKit from 1.5.33 to 1.5.34.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@milang
Copy link
Contributor Author

milang commented Jan 7, 2025

@Aaronontheweb update Akka.TestKit.NUnit to the latest Akka.NET that was released today.

@Aaronontheweb Aaronontheweb merged commit 4437518 into akkadotnet:dev Jan 7, 2025
2 checks passed
@milang milang deleted the akka1534 branch January 7, 2025 20:44
@milang
Copy link
Contributor Author

milang commented Jan 7, 2025

@Aaronontheweb could you please publish the new build to NuGet?

@Aaronontheweb
Copy link
Member

Sure thing, I'll see about doing that - btw, do you think this issue is related to the one you fixed? akkadotnet/akka.net#7442

It's an issue with the main Akka.NET TestKit, so not specific to NUnit.

@milang
Copy link
Contributor Author

milang commented Jan 7, 2025

@Aaronontheweb

Thank you for the publish.

Do you think this issue is related to the one you fixed?

I don't think so, the reproduction repository is using XUnit -- unless a similar technique is used in Akka.TestKit.XUnit to build the assertion message, passing the message + arguments directly to string.Format.

@milang
Copy link
Contributor Author

milang commented Jan 7, 2025

@Aaronontheweb

Do you think this issue is related to the one you fixed?

Actually you are correct, it is the same reason as the NUnit failure. Current Akka.TestKit.Xunit2 implementation just forwards the message and arguments directly to string.Format:
https://github.com/akkadotnet/akka.net/blob/dev/src/contrib/testkits/Akka.TestKit.Xunit2/XunitAssertions.cs#L37

image

The fix should be the same as #159, return the message as-is if no formatting arguments were specified. If Xunit doesn't have a helper method like NUnit, you can implement your own:

private static string BuildAssertMessage(string? format, object?[]? args)
{
    return string.IsNullOrEmpty(format)
        ? string.Empty
        : args is { Length: > 0 } // C# pattern matching, not available in older compilers
            ? string.Format(format, args)
            : format;
}

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