iphone - IOS/Unit ST AssertThrows-链接到文档和使用示例

标签 iphone ios ocunit

任何人都有一个或两个指向“STAssertThrows”的IOS / OCUnit文档的链接

API doco +如何使用示例

最佳答案

Here are the docs.

用法很简单,说您有方法

-(void)foo {
  [NSException raise:NSInvalidArgumentException format:@"always thrown"];
}

然后,该断言将始终通过
-(void)testFoo {
    STAssertThrows([obj foo], @"should throw an exception");
}

您可能想改用STAssertThrowsSpecificSTAssertThrowsSpecificNamed,因为如果您仅捕获任何异常,可能会难以捕获bug。

关于iphone - IOS/Unit ST AssertThrows-链接到文档和使用示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8335460/

相关文章:

iphone - 如何在Three20的AppDelegate中添加全局右栏按钮(UINavigationController)

ios - 获取有关函数调用者的信息

objective-c - 在 ocUnit 中比较 NSArray

unit-testing - SenTestKit : cleaning up after ALL tests have run?

xcode - 如何使用 OCUnit/XCTest 检查对象上是否存在属性?

iPhone - 如何确定设备的运营商(AT&T、Verizon 等?)

iphone - CGContextSetShadow 不产生任何结果

iphone - iOS 5 iPhone 4 Interface Builder 突然间我的所有 View 都变得透明了。怎么修?

ios - UITextField 溢出

ios - 在 Xcode 10 上使用 Date Picker 对象获取时间输入