Git Product home page Git Product logo

Comments (1)

ParsifalC avatar ParsifalC commented on May 29, 2024

@gonghongxia 额,不是很明白你说的是哪个情况。原有dealloc方法为什么会未处理呢?不过关于dealloc方法的处理是可以单独拎出来写的,当时只是为了尝试下方案的可行性,零零散散地写得比较随便。另外,测试用例也可以优化下,现在这样有点low。哈哈。可以提供个思路给你,有空的话可以直接写完提PR。测试用例这块,可以分为不同的tester写,然后通过runtime去遍历tester的方法,最终效果大概是首页是不同类型的tester,点击tester后,到另一个页面,是具体的每个Test Case。大致是这样子的:

+ (instancetype)tester:(WYCrashDoctorType)type {
    switch (type) {
        case WYCrashDoctorUnrecognizedSelector:
            return [WYUnrecognizedSelectorTester new];
        case WYCrashDoctorCollection:
            return [WYCollectionTester new];
        case WYCrashDoctorKVO:
            return [WYKVOTester new];
        case WYCrashDoctorTimer:
            return [WYTimerTester new];
        case WYCrashDoctorString: {
            return [WYStringTester new];
        case WYCrashDoctorNotification:
            return [WYNotificationTester new];
        case WYCrashDoctorUI:
            return [WYUITester new];
        case WYCrashDoctorBadAccess:
            return [WYBadAccessTester new];
        case WYCrashDoctorBooting:
            return [WYBootingTester new];
        }
            
        default:
            return [self new];
    }
}
- (NSArray *)testCaseSelectors {
    NSMutableArray *seletors = @[].mutableCopy;
    unsigned int outCount;
    Method *methodList = class_copyMethodList([self class], &outCount);
    
    for (unsigned int i = 0; i < outCount; i++) {
        Method method = methodList[i];
        NSString *selStr = NSStringFromSelector(method_getName(method));
        
        if ([selStr hasPrefix:@"test_"]) {
            [seletors addObject:selStr];
        }
    }
    
    free(methodList);
    return seletors;
}

from neteasebaymaxdemo.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.