[swift-corelibs-dev] Testcases for NSDateFormatter

Philippe Hausler phausler at apple.com
Fri Feb 19 18:35:44 CST 2016


The problem with the change in that commit is that it is doing two different things: it is testing against python which is not the definition of Foundation’s expected output instead of testing against the expected output from the objective-c implementation. My suggestion in the pull request was to just encode a dictionary of dates to strings sampling a well known range before hand. This way it would be verifiable on both linux and Darwin as “correct” in accordance with the version of Foundation.framework that ships on Mac OS X and iOS. 

The rest of the additions seemed pretty reasonable to me, except the case of calling popen to run a secondary script that may take extra execution time and add extra complexity other than just a dictionary of some good example date to string conversions (which actually could be utilized to reverse the test as well for scanning).

> On Feb 19, 2016, at 4:13 PM, Taylor Franklin via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> Hello,
> 
> Are there any plans to integrate this commit into the main repo because I would love build off of the code within it, seeing that NSDateFormatter still seems incomplete. Additionally, the issue mentioned earlier, https://bugs.swift.org/browse/SR-208 <https://bugs.swift.org/browse/SR-208>, is still valid with the latest code from master.
> 
> In fact, stringFromDate doesn't seem to be doing much at all. Anyway, I would love to hear more from Joe or an admin on plans and progress for NSDateFormatter.
> 
> Thanks,
> Taylor Franklin
> 
> > Howdy,
> > 
> > A few weeks ago I opened https://bugs.swift.org/browse/SR-208 <https://bugs.swift.org/browse/SR-208> as it appears
> > setting the dateFormat property of NSDateFormatter has no effect. It's
> > been open for a while and I thought I'd start looking at whether or not I
> > could help, and decided to first start with getting NSDateFormatter
> > included in TestFoundation.
> > 
> > Before moving on further and issuing a PR, I would appreciate feedback on
> > the approach that I'm taking here:
> > 
> > https://github.com/iachievedit/swift-corelibs-foundation/commit/482d861127e8b78007ceaf15f6c905ac04b1e9a4 <https://github.com/iachievedit/swift-corelibs-foundation/commit/482d861127e8b78007ceaf15f6c905ac04b1e9a4>
> > 
> > The first tests are only looking at the dateStyle property, and I've
> > included tests for the various styles as they are rendered for the en_US
> > locale. The intent is to add support for validating additional locales in
> > the future.
> > 
> > Since strptime doesn't appear to be available to the Glibc module I'm using
> > a quick Python script included in Resources/ to take a format string and
> > render a human-friendly date.
> > 
> > At the moment I know there is a discrepancy between what NSDateFormatter
> > and the python driver can emit, the python script is currently adjusting to
> > my timezone and not using UTC, but that will be fixed before a PR is
> > issued. I'll also add the timeStyle property and then continue to add
> > tests.
> > 
> > Thoughts and comments most welcome, and Happy New Year.
> > 
> > Joe
> > 
> > 
> > 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160219/128d6b74/attachment.html>


More information about the swift-corelibs-dev mailing list