开发者

How can I use Extension functions from the parent class for my own subclass in Tests?

开发者 https://www.devze.com 2023-03-18 19:19 出处:网络
I have a class derived from NSTreeController named CSMCustomTreeController and imported the header data from s开发者_如何学运维ome Extensions of NSTreeController

I have a class derived from NSTreeController named CSMCustomTreeController and imported the header data from s开发者_如何学运维ome 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消