如何在测试中将父类中的扩展函数用于我自己的子类?

发布于 2024-11-19 12:12:22 字数 651 浏览 4 评论 0原文

的一些扩展中导入了标头数据。

我有一个从 NSTreeController 派生的类,名为 CSMCustomTreeController,并从 NSTreeController CSMCustomTreeController.h

#import "NSTreeController_Extensions.h"


@interface CSMCustomTreeController : NSTreeController {
...

扩展已定义 NSTreeController_Extensions.h

#import "NSTreeController_Extensions.h"
#import "NSTreeNode_Extensions.h"
#import "NSIndexPath_Extensions.h"
#import "NSArray_Extensions.h"

@implementation NSTreeController (ESExtensions)
...

我可以使用所有定义的我的正常目标中来自 ESExtensions 的函数,但在我的测试用例中,似乎我的子类对扩展函数一无所知...:(

只有我的测试用例被添加到测试目标...

有人有线索吗?

I have a class derived from NSTreeController named CSMCustomTreeController and imported the header data from some Extensions of NSTreeController

CSMCustomTreeController.h

#import "NSTreeController_Extensions.h"


@interface CSMCustomTreeController : NSTreeController {
...

The Extension ist defined NSTreeController_Extensions.h:

#import "NSTreeController_Extensions.h"
#import "NSTreeNode_Extensions.h"
#import "NSIndexPath_Extensions.h"
#import "NSArray_Extensions.h"

@implementation NSTreeController (ESExtensions)
...

I can use all the defined Functions from ESExtensions in my normal target, but in my TestCases it seems that my subclass doesn't know anything about the extension functions... :(

Only my testcases are added to the Test-Target...

Anybody a clue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如果没结果 2024-11-26 12:12:22

您应该确保两个标头(CSMCustomTreeController.hNSTreeController_Extensions.h)都导入到您的测试用例类中。

如果您不导入包含类别的标头,测试用例类将无法找到您的类别方法。

You should make sure that both headers (CSMCustomTreeController.h and NSTreeController_Extensions.h) are imported into your test case class.

If you don't import the header containing the category, the test case class will not be able to find your category methods.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文