3

我的 Kiwi 单元测试在这两行中失败是否有某些原因:

[[theValue([editAuthorViewController class] == [EditAuthorViewController class]) should] beYes];

[[theValue([editAuthorViewController isKindOfClass:[EditAuthorViewController class]]) should] beYes];

当这条线通过时?

NSString *classString = NSStringFromClass([editAuthorViewController class]);
[[classString should] equal:@"EditAuthorViewController"];
4

1 回答 1

6

原来有一个猕猴桃表达来测试这个我不知道。

[[editAuthorViewController should] beKindOfClass:[EditAuthorViewController class]];

这最初失败了,因为我的EditAuthorViewController.m文件已添加到我的测试目标中。由于[EditAuthorViewController class] 在从测试包内部调用时返回了不同的指针,因此比较失败。

为了解决这个问题,我必须EditAuthorViewController.m从我的测试目标中的编译源中删除。

于 2013-12-22T06:10:37.267 回答