Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
yh_analytics
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
周蓉君
10 years ago
Commit
a7060c817f6ac20ba603b3283283a3f2edf33753
1 parent
2e11c38f
更新测试样例。Review by 阿瑟。
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
13 deletions
YH_Analytics/YH_Analytics/YH_Analytics/NSString+YHAnalytics.m
YH_Analytics/YH_Analytics/YH_Analytics/Utils/YHAssemblyAssistant.m
YH_Analytics/YH_Analytics/YH_Analytics/Utils/YHCrashReporter.m
YH_Analytics/YH_Analytics/YH_Analytics/YH_Analytics.m
YH_Analytics/YH_AnalyticsTests/NSString+YHAnalyticsTests.m
YH_Analytics/YH_AnalyticsTests/YHCrashReporterTests.m
YH_Analytics/YH_AnalyticsTests/YH_AnalyticsTests.m
YH_Analytics/YH_Analytics/YH_Analytics/NSString+YHAnalytics.m
View file @
a7060c8
...
...
@@ -11,7 +11,7 @@
@implementation
NSString
(
YHAnalytics
)
-
(
NSString
*
)
md5
-
(
NSString
*
)
md5
{
const
char
*
cStr
=
[
self
UTF8String
];
unsigned
char
result
[
16
];
...
...
YH_Analytics/YH_Analytics/YH_Analytics/Utils/YHAssemblyAssistant.m
View file @
a7060c8
...
...
@@ -315,7 +315,7 @@ static dispatch_queue_t persisitingQueue;
// 删除本地持久化文件
-
(
void
)
removeLocalFile
{
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
self
.
eventFilePath
])
{
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
self
.
eventFileName
])
{
[[
NSFileManager
defaultManager
]
removeItemAtPath
:
self
.
eventFileName
error
:
nil
];
}
self
.
allEventsCount
=
0
;
...
...
YH_Analytics/YH_Analytics/YH_Analytics/Utils/YHCrashReporter.m
View file @
a7060c8
...
...
@@ -122,17 +122,15 @@ void uncaughtCrashExceptionHandler(NSException *exception)
{
NSLog
(
@"crash============:
\n
%@"
,
userInfo
);
if
(
userInfo
)
{
[[
YH_Analytics
shareInstance
]
logError
:
@"CRASH"
parameters
:
@
{
JsonKeyErrorST
:
userInfo
}];
[[
YH_Analytics
shareInstance
]
logError
:
@"CRASH"
parameters
:
@
{
JsonKeyErrorST
:
userInfo
}];
}
}
-
(
void
)
handleNSException
:
(
NSDictionary
*
)
userInfo
{
NSLog
(
@"crash============:
\n
%@"
,
userInfo
);
NSLog
(
@"crash============:
\n
%@"
,
userInfo
);
if
(
userInfo
)
{
[[
YH_Analytics
shareInstance
]
logError
:
@"CRASH"
parameters
:
@
{
JsonKeyErrorST
:
userInfo
}];
[[
YH_Analytics
shareInstance
]
logError
:
@"CRASH"
parameters
:
@
{
JsonKeyErrorST
:
userInfo
}];
}
}
...
...
YH_Analytics/YH_Analytics/YH_Analytics/YH_Analytics.m
View file @
a7060c8
...
...
@@ -127,6 +127,10 @@ static dispatch_queue_t persisitingQueue;
return
self
;
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
#pragma mark - Properties
...
...
YH_Analytics/YH_AnalyticsTests/NSString+YHAnalyticsTests.m
View file @
a7060c8
...
...
@@ -11,7 +11,10 @@
#import "OCMock.h"
#import "NSString+YHAnalytics.h"
@interface
NSString_YHAnalyticsTests
:
XCTestCase
@interface
NSString_YHAnalyticsTests
:
XCTestCase
{
@private
id
mock
;
}
@end
...
...
@@ -20,16 +23,29 @@
-
(
void
)
setUp
{
[
super
setUp
];
// Put setup code here. This method is called before the invocation of each test method in the class.
NSLog
(
@"%@ setUp"
,
self
.
name
);
mock
=
[
OCMockObject
mockForClass
:[
NSString
class
]];
XCTAssertNotNil
(
mock
,
@"Cannot create NSString mock"
);
}
-
(
void
)
tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[
super
tearDown
];
NSLog
(
@"%@ tearDown"
,
self
.
name
);
}
-
(
void
)
testMd5Method
{
NSLog
(
@"%@ start"
,
self
.
name
);
[[
mock
stub
]
md5
];
[
mock
md5
];
NSLog
(
@"%@ end"
,
self
.
name
);
}
-
(
void
)
testExample
{
// This is an example of a functional test case.
XCTAssert
(
YES
,
@"Pass"
);
-
(
void
)
testUrlDecodedStringMethod
{
NSLog
(
@"%@ start"
,
self
.
name
);
[[
mock
stub
]
urlDecodedString
];
[
mock
urlDecodedString
];
NSLog
(
@"%@ end"
,
self
.
name
);
}
@end
...
...
YH_Analytics/YH_AnalyticsTests/YHCrashReporterTests.m
View file @
a7060c8
...
...
@@ -11,7 +11,10 @@
#import "OCMock.h"
#import "YHCrashReporter.h"
@interface
YHCrashReporterTests
:
XCTestCase
@interface
YHCrashReporterTests
:
XCTestCase
{
@private
id
mock
;
}
@end
...
...
@@ -20,6 +23,9 @@
-
(
void
)
setUp
{
[
super
setUp
];
// Put setup code here. This method is called before the invocation of each test method in the class.
NSLog
(
@"%@ setUp"
,
self
.
name
);
mock
=
[
OCMockObject
mockForClass
:[
YHCrashReporter
class
]];
XCTAssertNotNil
(
mock
,
@"Cannot create YHCrashReporter mock"
);
}
-
(
void
)
tearDown
{
...
...
YH_Analytics/YH_AnalyticsTests/YH_AnalyticsTests.m
View file @
a7060c8
...
...
@@ -25,7 +25,7 @@
// Put setup code here. This method is called before the invocation of each test method in the class.
NSLog
(
@"%@ setUp"
,
self
.
name
);
mock
=
[
OCMockObject
mockForClass
:[
YH_Analytics
class
]];
XCTAssertNotNil
(
mock
,
@"Cannot create YH_Analytics
instance
"
);
XCTAssertNotNil
(
mock
,
@"Cannot create YH_Analytics
mock
"
);
}
-
(
void
)
tearDown
{
...
...
@@ -34,6 +34,8 @@
NSLog
(
@"%@ tearDown"
,
self
.
name
);
}
#pragma mark - 方法存在性验证
-
(
void
)
testStartWithAppIdMethodWithConstraint
{
NSLog
(
@"%@ start"
,
self
.
name
);
// self.name is the name of the test-case method.
...
...
Please
register
or
login
to post a comment