Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMRouter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMRouter
Commits
d38a1966
Commit
d38a1966
authored
Sep 07, 2020
by
jz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
88570107
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
24 deletions
+104
-24
Target_GMRouterCase.m
Example/Tests/Target_GMRouterCase.m
+104
-24
No files found.
Example/Tests/Target_GMRouterCase.m
View file @
d38a1966
...
@@ -18,30 +18,6 @@
...
@@ -18,30 +18,6 @@
@implementation
Target_GMRouterCase
@implementation
Target_GMRouterCase
-
(
UIViewController
*
)
common_params
:(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
!=
0
,
@"common_params 参数解析失败"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
common_no_params
:(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
==
0
,
@"common_no_params 应该不会有参数"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
common_params_action
:(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
if
(
vc
.
routerCompleteBlock
)
{
XCTAssertTrue
(
NO
,
@"common_params_action 测试失败block 不应该有值"
);
}
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
void
)
setUp
{
-
(
void
)
setUp
{
// Put setup code here. This method is called before the invocation of each test method in the class.
// Put setup code here. This method is called before the invocation of each test method in the class.
...
@@ -58,11 +34,61 @@
...
@@ -58,11 +34,61 @@
-
(
void
)
testExample
{
-
(
void
)
testExample
{
// This is an example of a functional test case.
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
// Use XCTAssert and related functions to verify your tests produce the correct results.
//测试不传参数的case
[
self
testNoParamsCase
];
[
self
testNoParamsCase
];
//测试传参数的case
[
self
testParamsCase
];
[
self
testParamsCase
];
//测试回调
[
self
testParams_action
];
[
self
testParams_action
];
//以下主要测试 pushUrlScheme parmas 这个方法的几种情况
[
self
testJustScheme
];
[
self
testSchemeAndDict
];
[
self
testQuerySchemeAndDict
];
}
}
#pragma mark - test 裸协议 just_scheme
-
(
void
)
testJustScheme
{
[[
GMRouter
sharedInstance
]
pushScheme
:
@"just_scheme"
params
:
NULL
];
}
-
(
UIViewController
*
)
just_scheme
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
==
0
,
@"just_scheme 应该不会有参数"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
#pragma mark - test scheme_params 以及字典参数
-
(
void
)
testSchemeAndDict
{
[[
GMRouter
sharedInstance
]
pushScheme
:
@"scheme_params"
params
:@{
@"service_id"
:
@"3333"
}];
}
-
(
UIViewController
*
)
scheme_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
!=
0
,
@"scheme_params 应该有参数"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
#pragma mark - test query_scheme_params 以及字典参数
-
(
void
)
testQuerySchemeAndDict
{
[[
GMRouter
sharedInstance
]
pushScheme
:
@"query_scheme_params?title=无极"
params
:@{
@"service_id"
:
@"3333"
}];
}
-
(
UIViewController
*
)
query_scheme_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
==
2
,
@"query_scheme_params 应该有两个参数"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
void
)
testNoParamsCase
{
-
(
void
)
testNoParamsCase
{
[[
GMRouter
sharedInstance
]
pushScheme
:
@"common_no_params"
];
[[
GMRouter
sharedInstance
]
pushScheme
:
@"common_no_params"
];
[[
GMRouter
sharedInstance
]
pushScheme
:
@"gengmei://common_no_params"
];
[[
GMRouter
sharedInstance
]
pushScheme
:
@"gengmei://common_no_params"
];
...
@@ -109,4 +135,58 @@
...
@@ -109,4 +135,58 @@
}];
}];
}
}
#pragma mark - 自定义外界传入urlscheme case 需要不断维护
-
(
UIViewController
*
)
common_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
!=
0
,
@"common_params 参数解析失败"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
common_no_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
XCTAssertTrue
(
params
.
allKeys
.
count
==
0
,
@"common_no_params 应该不会有参数"
);
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
common_params_action
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
if
(
vc
.
routerCompleteBlock
)
{
XCTAssertTrue
(
NO
,
@"common_params_action 测试失败block 不应该有值"
);
}
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
query_scheme
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
if
(
vc
.
routerCompleteBlock
)
{
XCTAssertTrue
(
NO
,
@"common_params_action 测试失败block 不应该有值"
);
}
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
scheme_custom_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
if
(
vc
.
routerCompleteBlock
)
{
XCTAssertTrue
(
NO
,
@"common_params_action 测试失败block 不应该有值"
);
}
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
-
(
UIViewController
*
)
query_scheme_custom_params
:
(
NSDictionary
*
)
params
{
GMViewController
*
vc
=
[[
GMViewController
alloc
]
init
];
if
(
vc
.
routerCompleteBlock
)
{
XCTAssertTrue
(
NO
,
@"common_params_action 测试失败block 不应该有值"
);
}
[[
GMRouterTool
getCurrentViewController
].
navigationController
pushViewController
:
vc
animated
:
YES
];
return
vc
;
}
@end
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment