BOOL
属性正在返回NO
,尽管它支持iVar表示它是Yes
。
我的课程PFIBinaryPointView
有BOOL
属性:
@property (nonatomic, getter=isGlowing) BOOL glowing;
我正在用Kiwi测试另一个班级sut
。此类的一部分是用于设置或取消设置numberToDisplay:
属性的方法glowing
。
context(@"when numberToDisplay is called", ^{
__block PFIBinaryPointView *point;
it(@"should activate the correct points for the number 1", ^{
[sut numberToDisplay:1];
point = [sut.binaryPoints objectAtIndex:0];
[[theValue([point isGlowing]) should] equal:theValue(YES)];
});
});
但是isGlowing
总是会返回NO
,尽管它的烘焙是iVar说它(应该是)YES
BOOL test = point.isGlowing;
但test
始终是NO
。 No
或0。PFIBinaryPointView
类,了解iVar的任何隐式声明。但是我使用默认的getter和setter,而且也没有@synthesize
。isActive
。所以,如果有人能解释我这种奇怪的行为,请这样做或者更好地告诉我如何说服该物业返回正确的结果。
答案 0 :(得分:1)
你可以尝试使用frame variable point._glowing并查看它报告的内容吗?
如果它对您而言,则是时候进行错误报告了
如果说的是正确的话,请尝试右键单击_glowing iVar,然后编辑其摘要。我怀疑在结果窗口中显示“是”。
答案 1 :(得分:0)
我在某些第三方代码中遇到此问题。看起来bool没有在任何地方初始化,xcode假设它实际上是自动初始化为false! (无论如何..初始化bool修复了我的问题)。