Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Crashes when running parameterized tests #513

Closed
@conradev

Description

@conradev

I have a protocol with two concrete implementations. I wrote tests for the protocol that look like this:

+ (NSArray *)testInvocations {
    NSMutableArray *testInvocations = [[super testInvocations] mutableCopy];

    NSArray *resolvers = @[[BFWebViewAppLinkResolver sharedInstance], [BFXMLAppLinkResolver sharedInstance]];

    unsigned count;
    Method *methods = class_copyMethodList(self, &count);
    for (unsigned i = 0; i < count; i++) {
        SEL selector = method_getName(methods[i]);
        NSString *name = NSStringFromSelector(selector);
        if ([name hasPrefix:@"test"] && [name hasSuffix:@"WithResolver:"]) {
            for (id<BFAppLinkResolving> resolver in resolvers) {
                NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self instanceMethodSignatureForSelector:selector]];
                [invocation setSelector:selector];
                [invocation setArgument:(void *)&resolver atIndex:2];
                [invocation retainArguments];
                [testInvocations addObject:invocation];
            }
        }
    }

    return [testInvocations copy];
}

...

- (void)testPlatformFilteringWithResolver:(id<BFAppLinkResolving>)resolver {
    ...
}

Currently, xctool crashes here. Are there any plans to support these kinds of tests at some point in the future?

It's unfortunately causing issues with this pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions