Improve code coverage for System.Globalization.Extensions
According to the current code coverage report, this library is only at 51%. Our general goal is closer to 90%, though this will depend on the library. We should investigate to see whether the current coverage level is appropriate, and if not, improve our test suites to provide better coverage.
@stephentoub I will look at this at some point. I agree we need better test coverage for this area
I'm working on this one.
@bpschoch thanks. I have started working on this one but you can continue doing it and I'll look at different issue. just some thoughts on this one,
- if your new test cases not working yet on Unix then you may mark it with the attribute [ActiveIssue(810, PlatformID.AnyUnix)] @stephentoub can give more details about that.
- when adding test cases for CompareInfo.GetStringComparer please consider testing with cultures like Turkish and invariant if possible with different CompareOptions values
- we may need to test some negative cases which trigger the exceptions when validating the Idn methods parameters to have more coverage there.
thanks again for your help here
ok sorry up stepping on. That's one of the complaints I have about not know who is working on what. I had assumed since it was 'up for grabs' that no one was working on it.
Thanks for the todo list. Yes I've started working on a list of 'throws' tests to catch the exceptions.
On the other cultures, is this something that can be setup in the test or only by changing the environment through control panel (I can look it up, but thought I would ask if you knew off hand)
ok sorry up stepping on. That's one of the complaints I have about not know who is working on what. I had assumed since it was 'up for grabs' that no one was working on it.
Usually if the issue is assigned to someone, you can check with this assignee to know the status of the issue. but you are right, I should put comment on the issue that I was looking at it :-)
On the other cultures, is this something that can be setup in the test or only by changing the environment through control panel (I can look it up, but thought I would ask if you knew off hand)
You can do this in the test without changing anything in the environment. Here is some example for Turkish culture:
var comparer = new CultureInfo("tr-TR").CompareInfo.GetStringComparer(CompareOptions.IgnoreCase)
let me know if you have any question
CompareInfo and StringComparer are not included in this namespace/project (and appear to be part of coreclr). Is it the intention to do unit tests in this project? ie is this the spot to test those classes here or is that part of the coreclr project? (I can't find where they test it) If so they don't appear in the code coverage so it will be hard to make sure it's all covered.
CompareInfo.GetStringComparer is implemented as extension method in the assembly System.globalization.Extensions so it is not part of coreclr. you may have a look at the source file http://dotnet-ci.cloudapp.net/job/dotnet_corefx_coverage_windows/238/artifact/bin/tests/coverage/System.Globalization.Extensions_GlobalizationExtensions.htm#djworkspacedotnet_corefx_coverage_windowssrcSystemGlobalizationExtensionssrcSystemGlobalizationExtensionscs it shows what code not having code coverage
Yes I understand that part, in fact I'm working on tests right now for that extension method. What I was asking is if I have to do functional tests for CompareInfo and StringComparer themselves or just the extensions themselves understanding I my have have to use a few of the methods of CompareInfo/StringComparer to verify that the extension methods are properly working.
The actual tests of the CompareInfo and StringComparer will be done in different place under System.Globalization For this current item (System.Globalization.Extensions) we need to focus only on the extension and we don't have to test the whole CompareInfo and StringComparer. but this doesn't prevent using CompareInfo and StringComparer in this test anyway we like.
thanks got it.