1

正しく実行しているかどうかはわかりませんが、コアデータオブジェクトで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 / ?";
     }
 }

これを実行すると、メソッドでSIGKILエラーが発生します。writeObjectValueToInvocationReturnValue

私は何かが足りないのですか?

アップデート

スタブを次のように変更しようとしました:

[mockCard stub:@selector(points) andReturn:theValue(1)]
...

 [FAILED], wrapped stub value type (i) could not be converted to the target type (v)
4

1 に答える 1

-1

これはKiwiのバグであり、ここで説明されています:https ://github.com/allending/Kiwi/issues/63

于 2011-10-28T17:33:23.093 に答える