我不知道如何解释它,这真的很奇怪。
我正在测试某个类的某些方法,只使用XCTest,在这个测试用例中我没有使用任何其他测试框架。
我第一次将字典转换为模型,并将其设置为局部变量时,效果很好。
但是第二次(刚刚第一次),它出了问题。我已经跟踪了堆栈,并且在使用新转换模型设置局部变量之前发现,一切都是正确,initWithDict
的返回值是正确的。但是当返回值设置为局部变量时,会出现一些奇怪的东西。
局部变量的指针不是返回值的指针。模特中的每一处房产都搞砸了。甚至一个属性也设置为 XXXXTests 类实例。它应该是我的测试类,我怎么能得到它并将其设置为模型???
修改
-(void)testFindSubDictionaryWithDictionary{
NSMutableDictionary* dict=[ToolMethod recursivelyMutateArrayOrDictionary:_miniComponentTreeData];
ComponentTreeDataManager* componentTreeDataManager=[ComponentTreeDataManager manager];
NSMutableDictionary* obj=[componentTreeDataManager findSubDictionaryWithDictionary:dict InvertListPath:@"dynamic,a_new" identification:@"triger_xinsui"];
}
我还发现修改输入字典不会影响结果。 第二时间会出错,首先不是第三次而不是第四次,只是第二次。
但是,如果我复制ComponentTreeDataModel* model=[[ComponentTreeDataModel alloc]initWithDict:obj];
,并做出类似的事情:
ComponentTreeDataModel* model=[[ComponentTreeDataModel alloc]initWithDict:obj];
ComponentTreeDataModel* model1=[[ComponentTreeDataModel alloc]initWithDict:obj];
ComponentTreeDataModel* model2=[[ComponentTreeDataModel alloc]initWithDict:obj];
ComponentTreeDataModel* model3=[[ComponentTreeDataModel alloc]initWithDict:obj];
然后,所有这些重复的模型都是对的。
任何人都可以帮助我,并解释它是什么???
答案 0 :(得分:0)
我认为这是Xcode变量检查器,它向我显示错误的数据。
我清理完项目后,现在看来是正确的。
Xcode总是浪费我的时间,叹息。
这是一个抱怨,而不是答案。