[swift-corelibs-dev] NSCoding methods

Luke Howard lukeh at padl.com
Wed Dec 30 09:26:30 CST 2015


I’ve written a few unit tests for NSKeyedArchiver/NSKeyedUnarchiver but it could do with lots more (if anyone is interested!). We are gated by some methods not having isEqual() implementations yet (which is used to verify the test results).

The tests pass on both Linux and OS X, although presently the user class test is disabled for Linux as subclassing NSObject outside of Foundation is broken.

The NSKeyedArchiver tests encode an object (graph), decode it and check it matches. The NSKeyedUnarchiver tests decode an object (graph) that was encoded using OS X Foundation. We currently don’t exercise NSKeyedArchiver writing to a file, although it does work on both platforms.

— Luke

Executed 24 tests, with 0 failures (0 unexpected) in 0.001 (0.022) seconds
Test Case 'TestNSKeyedArchiver.test_archive_array' started.
Test Case 'TestNSKeyedArchiver.test_archive_array' passed (0.01 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_dictionary' started.
Test Case 'TestNSKeyedArchiver.test_archive_dictionary' passed (0.013 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_string' started.
Test Case 'TestNSKeyedArchiver.test_archive_string' passed (0.003 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_mutable_array' started.
Test Case 'TestNSKeyedArchiver.test_archive_mutable_array' passed (0.01 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_mutable_dictionary' started.
Test Case 'TestNSKeyedArchiver.test_archive_mutable_dictionary' passed (0.008 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_null' started.
Test Case 'TestNSKeyedArchiver.test_archive_null' passed (0.006 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_set' started.
Test Case 'TestNSKeyedArchiver.test_archive_set' passed (0.006 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_url' started.
Test Case 'TestNSKeyedArchiver.test_archive_url' passed (0.007 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_user_class' started.
Test Case 'TestNSKeyedArchiver.test_archive_user_class' passed (0.0 seconds).
Test Case 'TestNSKeyedArchiver.test_archive_uuid' started.
Test Case 'TestNSKeyedArchiver.test_archive_uuid' passed (0.008 seconds).
Executed 10 tests, with 0 failures (0 unexpected) in 0.007 (0.071) seconds
Test Case 'TestNSKeyedUnarchiver.test_unarchive_array' started.
Test Case 'TestNSKeyedUnarchiver.test_unarchive_array' passed (0.004 seconds).
Test Case 'TestNSKeyedUnarchiver.test_unarchive_complex' started.
Test Case 'TestNSKeyedUnarchiver.test_unarchive_complex' passed (0.012 seconds).
Test Case 'TestNSKeyedUnarchiver.test_unarchive_concrete_value' started.
Test Case 'TestNSKeyedUnarchiver.test_unarchive_concrete_value' passed (0.01 seconds).
Test Case 'TestNSKeyedUnarchiver.test_unarchive_url' started.
Test Case 'TestNSKeyedUnarchiver.test_unarchive_url' passed (0.005 seconds).
Test Case 'TestNSKeyedUnarchiver.test_unarchive_uuid' started.
Test Case 'TestNSKeyedUnarchiver.test_unarchive_uuid' passed (0.003 seconds).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20151231/2a52297c/attachment.html>


More information about the swift-corelibs-dev mailing list