DateTimeFormatInCSharp: retarget net10.0, MSTest 4.3.3, deterministic assertions - #2153
Open
vladimir-pecanac-main wants to merge 1 commit into
Open
Conversation
… assertions Retarget both projects from net6.0 to net10.0 and lift the 2021-era test packages with it: Microsoft.NET.Test.Sdk 18.9.0, MSTest.TestAdapter and MSTest.TestFramework 4.3.3, coverlet.collector 10.0.1. MSTest 4 removed [ExpectedException], so the ja-JP ParseExact test now uses Assert.ThrowsExactly<FormatException>. Three assertions only passed on a machine whose clock is UTC and now hold anywhere: - %K on a DateTimeKind.Local value prints the machine's offset, so the expectation is computed from TimeZoneInfo.Local instead of hard-coded +00:00. - The RFC 1123 and universal-sortable tests called ToUniversalTime() on an Unspecified value, which converts from the local zone. Both values are now created as Utc, which is what the tests are about anyway. The character between the time and its AM/PM designator comes from the host's ICU data, not from the .NET version (dotnet/runtime#96022, "working as designed"), so en-US emits U+0020 on some hosts and U+202F on others. Console output is compared through TextExpectation.NormalizeSpaces, which folds Unicode space separators to a plain space, rather than pasting an invisible character into a string literal. Program.cs is left as it is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retargets
dotnet-datetime/DateTimeFormatInCSharpfrom net6.0 to net10.0 and lifts the test packages with it (Microsoft.NET.Test.Sdk 18.9.0, MSTest 4.3.3, coverlet.collector 10.0.1).MSTest 4 removed
[ExpectedException], so that one test now usesAssert.ThrowsExactly<FormatException>.Three assertions only passed where the machine clock is UTC and now hold anywhere:
%Kon aDateTimeKind.Localvalue prints the machine's offset; the expectation is computed fromTimeZoneInfo.Localinstead of a hard-coded+00:00.ToUniversalTime()on anUnspecifiedvalue, which converts from the local zone. Both values are now created asUtc.The character between the time and its AM/PM designator comes from the host's ICU data, not from the .NET version (dotnet/runtime#96022, closed "working as designed"), so
en-USemits U+0020 on some hosts and U+202F on others. Console output is compared through a small helper that folds Unicode space separators to a plain space, instead of pasting an invisible character into a string literal.Build and all 39 tests green on SDK 10.0.302.