简体   繁体   English

Objective-C中的单元测试私有类

[英]Unit test private class in Objective-C

How do you unit test a private class in Objective-C? 如何在Objective-C中对私有类进行单元测试? Is it possible when both the @interface and the @implementation of the class are included in a .m implementation file? 是否有可能在类的@interface@implementation都包含在.m实现文件中?

Refactoring the interface of the private class into its own header is not allowed by the restrictions of the project. 项目的限制不允许将私有类的接口重构为自己的头。

This is a whole private class I would like to test, not a private method of a public class . 这是我想要测试的整个私有类,而不是公共类的私有方法

Apparently, duplicating the private interface in the test file is enough. 显然,复制测试文件中的私有接口就足够了。 Damn, Objective-C is dangerous! 该死的,Objective-C很危险!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM