URLManager?е????????????
???????????? ???????[ 2015/1/8 14:09:32 ] ?????????????????? ??????? ????????
????????????????iOS?????е???????????&?????????н??????????????????±?????е????????????OCUnit??GHUnit????????????????????????????URLManager??
????URLManager?????????UINavigationController??UIViewController????URL Scheme?????????????????????????ViewController????????????????
??????????????????
????????????????????????????????????????????????????????ò???Target?????????????
???????????????????UMTestCase??????1????????????????????UMTestCase??
????#import
????@interface UMTestCase : GHTestCase
????@end
????????1??UMTestCase??????????
????????????
????URLManager??????UMTools????????????UMToolsTestCase????UMTools???????NSURL??NSString??UIView???????漰????URL???QueryString???QueryString?ж?????????????????????ж??????URL???????????UIView??x??y??width??height??????д?????????????ж??????????л??????????????2???? ????setUpClass?г?????????????3????
????????2??????????// ???????????????????????
@property (strong?? nonatomic) NSString *string;
// ???????????????????
@property (strong?? nonatomic) NSString *stringWithoutNumber;
// ??????URLEncode?????????????????????????
@property (strong?? nonatomic) NSString *toBeEncode;
// ?? toBeEncode ???????
@property (strong?? nonatomic) NSString *encoded;
// ?????URL??????QueryString
@property (strong?? nonatomic) NSURL *url;
// ?????????URL??QueryString
@property (strong?? nonatomic) NSURL *noQueryUrl;
// ????????UIView
@property (strong?? nonatomic) UIView *view;
(void)setUpClass
{
self.stringWithoutNumber = @"NSString For Test.";
self.toBeEncode = @"~!@#$%^&*()_+=-[]{}:;"'<>.??/?123qwe????";
self.encoded = @"%7E%21%40%23%24%25%5E%26%2A%28%29_%2B%3D-%5B%5D%
7B%7D%3A%3B%22%27%3C%3E.%2C%2F%3F123qwe%E6%B1%89%E5%AD%97";
self.url = [NSURL URLWithString:@"http://example.com
/patha/pathb/?p2=v2&p1=v1"];
self.noQueryUrl = [NSURL URLWithString:@"http://example.com
/patha/pathb/"];
self.view = [[UIView alloc] initWithFrame:CGRectMake(10.0f??
10.0f?? 100.0f?? 100.f)];
}
|
????????3???????????
????????????????е????????????
??????????????в?????????·???????????4???? ??“ContainsString”???????????????????????????YES??NO?????????????
#pragma mark - UMString
- (void)testUMStringContainsString
{
NSString *p = @"For";
NSString *np = @"BAD";
GHAssertTrue([self.string containsString:p]??
@""%@" should contains "%@"."??
self.string?? p);
GHAssertFalse([self.string containsString:np]??
@""%@" should not contain "%@"."??
self.string?? p);
|
????????4???????????????
?????????????????????????????·???????????????????????????????磬??URLEncode??????????5????????????????????????в???????????????????????????????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11