Tester robust to test or tests suite with null name

This commit is contained in:
Benjamin Reis 2017-01-04 16:40:56 +01:00
parent 98df3fd37a
commit 1703bfefa5
2 changed files with 18 additions and 11 deletions

View file

@ -83,7 +83,10 @@ static NSString *const kAllTestsName = @"Run All tests";
if ([self.detailItem isEqualToString:@"All"]) {
// dont sort tests if we use all suites at once
for (int i = 0; i < bc_tester_nb_suites(); i++) {
[self addTestsFromSuite:[NSString stringWithUTF8String:bc_tester_suite_name(i)]];
const char *suite = bc_tester_suite_name(i);
if (suite) {
[self addTestsFromSuite:[NSString stringWithUTF8String:suite]];
}
}
} else {
[self addTestsFromSuite:self.detailItem];

View file

@ -36,18 +36,22 @@ void dummy_logger(const char *domain, OrtpLogLevel lev, const char *fmt, va_list
for (int k = 0; k < test_count; k++) {
const char *test = bc_tester_test_name(suite, k);
LOGE(@"\ttest = %s", test);
NSString *sSuite = [NSString stringWithUTF8String:suite];
NSString *sTest = [NSString stringWithUTF8String:test];
if (suite) {
NSString *sSuite = [NSString stringWithUTF8String:suite];
if (test) {
NSString *sTest = [NSString stringWithUTF8String:test];
// prepend "test_" so that it gets found by introspection
NSString *safesTest = [self safetyTestString:sTest];
NSString *safesSuite = [self safetyTestString:sSuite];
NSString *selectorName = [NSString stringWithFormat:@"test_%@__%@", safesSuite, safesTest];
// prepend "test_" so that it gets found by introspection
NSString *safesTest = [self safetyTestString:sTest];
NSString *safesSuite = [self safetyTestString:sSuite];
NSString *selectorName = [NSString stringWithFormat:@"test_%@__%@", safesSuite, safesTest];
[LinphoneTester_Tests addInstanceMethodWithSelectorName:selectorName
block:^(LinphoneTester_Tests *myself) {
[myself testForSuite:sSuite andTest:sTest];
}];
[LinphoneTester_Tests addInstanceMethodWithSelectorName:selectorName
block:^(LinphoneTester_Tests *myself) {
[myself testForSuite:sSuite andTest:sTest];
}];
}
}
}
}
}