Kiwi 存根无法与 NSNumber 一起使用,以 SIGKILL 结尾
我不确定我做得是否正确,但我正在尝试在核心数据对象上存根 NSNumber 属性。
这是我的测试示例:
it(@"should say 1 / ? with 1 point", ^{
mockCard = [KWMock nullMockForClass:[Card class]];
[mockCard stub:@selector(points) andReturn:[NSNumber numberWithInt:1]];
controller.card = mockCard;
[[controller.lblCount.text should] equal:@"1 / ?"];
});
以及我的源代码:
-(void)setCard:(Card *)aCard{
if ([card.points intValue] == 1) {
lblCount.text = @"1 / ?";
}
}
运行此示例会导致 writeObjectValueToInvocationReturnValue
方法中出现 SIGKIL
错误。
我错过了什么吗?
更新
尝试将存根更改为:
[mockCard stub:@selector(points) andReturn:theValue(1)]
...
[FAILED], wrapped stub value type (i) could not be converted to the target type (v)
I'm not sure if I'm doing it right but I'm trying to stub an NSNumber property on a core data object.
Here's my test example:
it(@"should say 1 / ? with 1 point", ^{
mockCard = [KWMock nullMockForClass:[Card class]];
[mockCard stub:@selector(points) andReturn:[NSNumber numberWithInt:1]];
controller.card = mockCard;
[[controller.lblCount.text should] equal:@"1 / ?"];
});
And my source code:
-(void)setCard:(Card *)aCard{
if ([card.points intValue] == 1) {
lblCount.text = @"1 / ?";
}
}
Running this causes a SIGKIL
error in the writeObjectValueToInvocationReturnValue
method.
Am I missing something?
Update
attempted to change the stub to:
[mockCard stub:@selector(points) andReturn:theValue(1)]
...
[FAILED], wrapped stub value type (i) could not be converted to the target type (v)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 Kiwi 中的错误,如下所述: https://github.com/allending/Kiwi/issues /63
This is bug in Kiwi and is described here: https://github.com/allending/Kiwi/issues/63