Cleanup CultureInfo tests#6683
Cleanup CultureInfo tests#6683stephentoub merged 1 commit intodotnet:masterfrom hughbe:globalization-tests-culture-info
Conversation
| CultureInfo myClone = myTestCulture.Clone() as CultureInfo; | ||
| Assert.True(myClone.Equals(myTestCulture)); | ||
| Assert.NotSame(myClone, myTestCulture); | ||
| CultureInfo culture = new CultureInfo(name); |
There was a problem hiding this comment.
I realize that "" represents an invariant culture, but it'd be good not to lose the test for CultureInfo.InvariantCulture explicitly.
There was a problem hiding this comment.
it would be if we explicitly use CultureInfo.InvariantCulture.Name for the sake of code readbility
|
A few comments/questions, otherwise LGTM. |
|
@stephentoub thanks for the comments, pushed a PR feedback commit |
| CultureInfo myCultureInfo = new CultureInfo(expectedName); | ||
| CompareInfo myCompareInfo = myCultureInfo.CompareInfo; | ||
| Assert.True(myCompareInfo.Name.Equals(expectedName, StringComparison.OrdinalIgnoreCase)); | ||
| // TOOD: Once #5463 is fixed, combine this into the InlineData for CompareInfo_Compare |
There was a problem hiding this comment.
I am not sure if Linux support es-es_tradnl. it is good we have issue to track the investigation.
|
@hughbe, could you rebase this to address the conflicts? Thanks. |
|
@stephentoub done :) |
|
Also, don't mean to sound pushy, but can we get this one merged before #7139 as that's gonna present more merge conflicts |
|
Makes sense, I'll fix the merge conflict once that ones merged. don't want to create extra work! |
|
done, thanks a bunch |
|
@hughbe because we are running out of time and I need to get my changes in soon, so I am going to merge my changes first and then we can merge your changes later after resolving any conflict. I can help in any of the issues that may pop up |
|
@hughbe I have merged my changes so you may pull the changes and update yours. the network is very slow today and looks everything take forever to do it :-( |
|
Ah that's fine! I completely understand - your changes are defo more important :) |
|
@tarekgh fixed the merge conflict. It was actually incredibly easy as git resolved the merge conflict automatically. Sorry to delay your work when time may not be on your side ;) |
|
@hughbe thanks a lot for following up. I am glad the merge was simple. |
|
@hughbe to let you know, I have cloned your branch, built it and then ran the globalization test on Windows 7 machine and it passed. so we should be good. |
|
@tarekgh good to know Just wondering why there are so many differences between Windows 7 and later versions of Windows? I'm surprised these were allowed as it seems the .NET management are extremely reticent to have breaking changes! |
Globalization in general depends on the running the OS to get the data (like culture data, Idn, Normalization...etc.). so in Windows 7 you can expect many of such data differ with later Windows versions and that cause the result we return will be different. do you remember when I said, I don't like to test against hardcoded data? that exactly the reason, this will cause to have our tests written with a lot of if (Platform.xxxx) and need to maintain that. let me know if you have any more question |
|
Thanks for the answer. I just have one follow-up? Are there any solutions to hardcoding data? Thanks |
|
Failure in the unix legs: |
My idea was manually to read the data from the OS and compare the results with what the framework return. we don't have to compare data to data, but we can compare results to results. for example we can read the default short date format from the OS, then format some date with what we read and then compare the result with the framework short date formatted date. and so on. |
|
Thanks for the answer! |
|
|
||
| if (PlatformDetection.IsWindows && PlatformDetection.WindowsVersion < 10) | ||
| { | ||
| Assert.Throws<CultureNotFoundException>(() => new CultureInfo("no-such-culture")); |
There was a problem hiding this comment.
Nit: indentation. Not worth fixing and restaring CI for if this is the only issue... can be addressed later.
|
@hughbe, this has conflicts now, I'm assuming from some of your other changes. Could you rebase again? |
Some duplication was present between tests, so I deleted some test files Also contributes to #2103 Also fixes some todos to enabled some tests for Windows 10
|
@stephentoub with pleasure, done |
|
Test Innerloop OSX Debug Build and Test please |
I'm getting the impression the CI hates me! Maybe this is revenge for stressing it with 500K tests the other day! |
|
It does seem to be holding a grudge ;) |
…-culture-info Cleanup CultureInfo tests Commit migrated from dotnet/corefx@1d35de1
Contributes to #2103