mirror of
https://github.com/MacPass/MacPass.git
synced 2026-02-01 14:58:17 +00:00
Split test into valid and invalid attributes
This commit is contained in:
@@ -37,15 +37,21 @@
|
|||||||
NSString *(*func2)(id, SEL, NSString*) = (void *)imp2;
|
NSString *(*func2)(id, SEL, NSString*) = (void *)imp2;
|
||||||
NSString *value2 = func2(entry, selector2, attribute2.key);
|
NSString *value2 = func2(entry, selector2, attribute2.key);
|
||||||
XCTAssertEqualObjects(value2, attribute2.value);
|
XCTAssertEqualObjects(value2, attribute2.value);
|
||||||
|
|
||||||
SEL selector3 = NSSelectorFromString([MPCustomAttributePropertyPrefix stringByAppendingString:@"novalidkey"]);
|
|
||||||
IMP imp3 = [entry methodForSelector:selector3];
|
|
||||||
NSString *(*func3)(id, SEL, NSString*) = (void *)imp3;
|
|
||||||
NSString *value3 = func3(entry, selector3, @"novalidkey");
|
|
||||||
XCTAssertNil(value3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testInvalidCustomAttribute {
|
- (void)testInvalidCustomAttribute {
|
||||||
|
KPKEntry *entry = [[KPKEntry alloc] init];
|
||||||
|
KPKAttribute *attribute1 = [[KPKAttribute alloc] initWithKey:@"custom1" value:@"value1"];
|
||||||
|
KPKAttribute *attribute2 = [[KPKAttribute alloc] initWithKey:@"custom2" value:@"value2"];
|
||||||
|
[entry addCustomAttribute:attribute1];
|
||||||
|
[entry addCustomAttribute:attribute2];
|
||||||
|
|
||||||
|
SEL selector = NSSelectorFromString([MPCustomAttributePropertyPrefix stringByAppendingString:@"novalidkey"]);
|
||||||
|
IMP imp = [entry methodForSelector:selector];
|
||||||
|
NSString *(*func)(id, SEL, NSString*) = (void *)imp;
|
||||||
|
NSString *value = func(entry, selector, @"novalidkey");
|
||||||
|
XCTAssertNil(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user