[swift-corelibs-dev] Strange behavior the same code fails when building a Cocoa CLI and succeeds in Swift-corelibs-foundation context.

Philippe Hausler phausler at apple.com
Mon Dec 18 11:40:12 CST 2017



> On Dec 18, 2017, at 9:29 AM, Benoit Pereira da silva <bpds at me.com> wrote:
> 
> Thanks Philippe,
> 
> 
>> Good find, 
>> You can make a pull request and we can get our continuous integration servers to start building that and testing your change – that is probably the easiest way to get validation on your tests and changes.
>> There are a few issues however with your test that might be worth considering. Comments inline…
>>> Building a CLI tool will use the objective-c Foundation in the system so that wont use your freshly built swift-corelibs-foundation. So that means we have a bug in the objc side if this is actually happening on Darwin (which is a completely different issue…) That should be a radar against Foundation and I definitely think that may very well be a bug… 
> 
> 
> I have been filling a radar https://bugreport.apple.com/web/?problemID=36107307 <https://bugreport.apple.com/web/?problemID=36107307>
Thanks for taking the time to file that! I will make sure that gets to the right owner.

> I do think you are right it's a bug in the Objc Foundation… and trying to solve it in "swift-corelibs-foundation" was a mistake :) 
> 
> 
>>>         setlocale(LC_ALL,"fr_FR”)
>> 
>> This change will set the locale globally for the rest of the process, you probably want to make sure to reset the locale back to it’s original state.
> 
> 
> Setting the locale globally was just a temporary test.
> 
> But i do think that it triggers a serious question:  Should all your tests be ran on all the available locales? 
> You will certainly find a smarter solution …

I think it is sensible to iterate through a key list of known locales that have certain characteristics, such as using the , as a decimal separator or « for quote begin etc (not to pick on French but it is the one I know better than other punctuation differentials from English).

There are probably key areas that are worth doing this to and others that probably do not matter so much. e.g. you don’t really need to test locale variations with NotificationCenter for example whereas NumberFormatter or JSONSerialization may be places that we want to test a few locales by subclassing the unit tests and in setup change the locale and teardown reset it.

> 
> Benoit
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20171218/0a805946/attachment.html>


More information about the swift-corelibs-dev mailing list