【发布时间】:2014-12-23 03:04:19
【问题描述】:
有没有办法测试我的对象在 XCTest.我正在考虑做这样的事情:
[self.client teardown];
__weak typeof(self.client) weakClient = self.client;
XCTestExpectation *teardownExpectation = ...;
dipatch_time_t delay = ...
dispatch_after(delay, dispatch_get_main_queue(), ^{
XCTAssertNil(weakClient);
[teardownExpectation fulfill];
}
self.client = nil;
[self waitForExpectationsWithTimeout:5.0 ...];
但是这样做的问题是自动释放池不会耗尽,所以我的对象实际上永远不会被释放。
还有其他方法可以测试吗?
【问题讨论】:
标签: ios objective-c xctest nsautoreleasepool