Why XCTest is not used for unit-tests?
valeriyvan opened this issue · comments
Just curious, why XCTest is not used for unit-tests?
great question!
the corelibs (especially Foundation) have well-known issues with portability and binary size, so i try to minimize usage of them as much as possible. this matters more for the library targets than the test targets, but these days i have so much Foundation-less infrastructure built already, it makes a lot of sense to me to use it for the tests as well.
the downside as you’ve discovered is this does not work well with @testable
, but my project-specific take on this is that PNGTests
shouldn’t be using @testable
at all; the currently non-public LZ77 APIs it is calling into should really be made public and split off into a separate LZ77
compression target that other libraries (like a future swift-gzip
package) could depend on. (this is tracked by #22 .) so my vision is eventually PNGTests
should become LZ77Tests
with the non DEFLATE-related tests moving into PNGIntegrationTests
, which should just become the new PNGTests
.
the tests for this library are quite old so you might still see the occasional import Foundation.exit
, but once i get around to fully migrating the tests to Testing
those should be gone as well.