appium-webdriveragent 5.1.6 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +15 -0
- package/WebDriverAgentLib/Categories/NSDictionary+FBUtf8SafeDictionary.h +40 -0
- package/WebDriverAgentLib/Categories/NSDictionary+FBUtf8SafeDictionary.m +88 -0
- package/WebDriverAgentLib/Routing/FBResponseJSONPayload.m +9 -0
- package/WebDriverAgentTests/IntegrationTests/FBScrollingTests.m +16 -0
- package/WebDriverAgentTests/UnitTests/NSDictionaryFBUtf8SafeTests.m +35 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.2.0](https://github.com/appium/WebDriverAgent/compare/v5.1.6...v5.2.0) (2023-05-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Replace non-encodable characters in the resulting JSON ([#713](https://github.com/appium/WebDriverAgent/issues/713)) ([cdfae40](https://github.com/appium/WebDriverAgent/commit/cdfae408be0bcf6607f0ca4462925eed2c300f5e))
|
|
7
|
+
|
|
1
8
|
## [5.1.6](https://github.com/appium/WebDriverAgent/compare/v5.1.5...v5.1.6) (2023-05-18)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -399,6 +399,9 @@
|
|
|
399
399
|
716E0BCE1E917E810087A825 /* NSString+FBXMLSafeString.h in Headers */ = {isa = PBXBuildFile; fileRef = 716E0BCC1E917E810087A825 /* NSString+FBXMLSafeString.h */; };
|
|
400
400
|
716E0BCF1E917E810087A825 /* NSString+FBXMLSafeString.m in Sources */ = {isa = PBXBuildFile; fileRef = 716E0BCD1E917E810087A825 /* NSString+FBXMLSafeString.m */; };
|
|
401
401
|
716E0BD11E917F260087A825 /* FBXMLSafeStringTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 716E0BD01E917F260087A825 /* FBXMLSafeStringTests.m */; };
|
|
402
|
+
716F0DA12A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 716F0D9F2A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h */; };
|
|
403
|
+
716F0DA32A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 716F0DA02A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m */; };
|
|
404
|
+
716F0DA62A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 716F0DA52A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m */; };
|
|
402
405
|
718226CA2587443700661B83 /* GCDAsyncUdpSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 718226C62587443600661B83 /* GCDAsyncUdpSocket.h */; };
|
|
403
406
|
718226CB2587443700661B83 /* GCDAsyncUdpSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 718226C62587443600661B83 /* GCDAsyncUdpSocket.h */; };
|
|
404
407
|
718226CC2587443700661B83 /* GCDAsyncSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 718226C72587443600661B83 /* GCDAsyncSocket.h */; };
|
|
@@ -1004,6 +1007,9 @@
|
|
|
1004
1007
|
716E0BCC1E917E810087A825 /* NSString+FBXMLSafeString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FBXMLSafeString.h"; sourceTree = "<group>"; };
|
|
1005
1008
|
716E0BCD1E917E810087A825 /* NSString+FBXMLSafeString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FBXMLSafeString.m"; sourceTree = "<group>"; };
|
|
1006
1009
|
716E0BD01E917F260087A825 /* FBXMLSafeStringTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBXMLSafeStringTests.m; sourceTree = "<group>"; };
|
|
1010
|
+
716F0D9F2A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+FBUtf8SafeDictionary.h"; sourceTree = "<group>"; };
|
|
1011
|
+
716F0DA02A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+FBUtf8SafeDictionary.m"; sourceTree = "<group>"; };
|
|
1012
|
+
716F0DA52A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSDictionaryFBUtf8SafeTests.m; sourceTree = "<group>"; };
|
|
1007
1013
|
717C0D702518ED2800CAA6EC /* TVOSSettings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TVOSSettings.xcconfig; sourceTree = "<group>"; };
|
|
1008
1014
|
717C0D862518ED7000CAA6EC /* TVOSTestSettings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TVOSTestSettings.xcconfig; sourceTree = "<group>"; };
|
|
1009
1015
|
718226C62587443600661B83 /* GCDAsyncUdpSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GCDAsyncUdpSocket.h; path = WebDriverAgentLib/Vendor/CocoaAsyncSocket/GCDAsyncUdpSocket.h; sourceTree = SOURCE_ROOT; };
|
|
@@ -1701,6 +1707,8 @@
|
|
|
1701
1707
|
EE9AB73E1CAEDF0C008C271F /* Categories */ = {
|
|
1702
1708
|
isa = PBXGroup;
|
|
1703
1709
|
children = (
|
|
1710
|
+
716F0D9F2A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h */,
|
|
1711
|
+
716F0DA02A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m */,
|
|
1704
1712
|
71555A3B1DEC460A007D4A8B /* NSExpression+FBFormat.h */,
|
|
1705
1713
|
71555A3C1DEC460A007D4A8B /* NSExpression+FBFormat.m */,
|
|
1706
1714
|
71A224E31DE2F56600844D55 /* NSPredicate+FBFormat.h */,
|
|
@@ -2022,6 +2030,7 @@
|
|
|
2022
2030
|
716E0BD01E917F260087A825 /* FBXMLSafeStringTests.m */,
|
|
2023
2031
|
712A0C841DA3E459007D02E5 /* FBXPathTests.m */,
|
|
2024
2032
|
EE9B76581CF7987300275851 /* Info.plist */,
|
|
2033
|
+
716F0DA52A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m */,
|
|
2025
2034
|
7139145B1DF01A12005896C2 /* NSExpressionFBFormatTests.m */,
|
|
2026
2035
|
71A224E71DE326C500844D55 /* NSPredicateFBFormatTests.m */,
|
|
2027
2036
|
713914591DF01989005896C2 /* XCUIElementHelpersTests.m */,
|
|
@@ -2405,6 +2414,7 @@
|
|
|
2405
2414
|
641EE6C02240C5CA00173FCB /* XCUIApplication+FBHelpers.h in Headers */,
|
|
2406
2415
|
641EE6C12240C5CA00173FCB /* _XCTestObservationCenterImplementation.h in Headers */,
|
|
2407
2416
|
714EAA0E2673FDFE005C5B47 /* FBCapabilities.h in Headers */,
|
|
2417
|
+
716F0DA22A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h in Headers */,
|
|
2408
2418
|
641EE6C22240C5CA00173FCB /* XCUIDevice+FBHelpers.h in Headers */,
|
|
2409
2419
|
71D3B3D6267FC7260076473D /* XCUIElement+FBResolve.h in Headers */,
|
|
2410
2420
|
641EE6C32240C5CA00173FCB /* FBClassChainQueryParser.h in Headers */,
|
|
@@ -2594,6 +2604,7 @@
|
|
|
2594
2604
|
EE35AD271E3B77D600A02D78 /* XCApplicationMonitor.h in Headers */,
|
|
2595
2605
|
EE8DDD7F20C5733C004D4925 /* XCUIElement+FBForceTouch.h in Headers */,
|
|
2596
2606
|
71A5C67329A4F39600421C37 /* XCTIssue+FBPatcher.h in Headers */,
|
|
2607
|
+
716F0DA12A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h in Headers */,
|
|
2597
2608
|
EE158AEA1CBD456F00A3E3F0 /* FBRuntimeUtils.h in Headers */,
|
|
2598
2609
|
7136A4791E8918E60024FC3D /* XCUIElement+FBPickerWheel.h in Headers */,
|
|
2599
2610
|
E444DCB324913C220060D7EB /* RoutingHTTPServer.h in Headers */,
|
|
@@ -3106,6 +3117,7 @@
|
|
|
3106
3117
|
641EE5FF2240C5CA00173FCB /* XCUIElement+FBForceTouch.m in Sources */,
|
|
3107
3118
|
716C9E0327315EFF005AD475 /* XCUIApplication+FBUIInterruptions.m in Sources */,
|
|
3108
3119
|
641EE6002240C5CA00173FCB /* FBTouchActionCommands.m in Sources */,
|
|
3120
|
+
716F0DA42A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m in Sources */,
|
|
3109
3121
|
719DCF182601EAFB000E765F /* FBNotificationsHelper.m in Sources */,
|
|
3110
3122
|
714EAA102673FDFE005C5B47 /* FBCapabilities.m in Sources */,
|
|
3111
3123
|
641EE6012240C5CA00173FCB /* FBImageIOScaler.m in Sources */,
|
|
@@ -3160,6 +3172,7 @@
|
|
|
3160
3172
|
buildActionMask = 2147483647;
|
|
3161
3173
|
files = (
|
|
3162
3174
|
64B26508228C5514002A5025 /* XCUIElementDouble.m in Sources */,
|
|
3175
|
+
716F0DA72A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m in Sources */,
|
|
3163
3176
|
64B26504228C5299002A5025 /* FBTVNavigationTrackerTests.m in Sources */,
|
|
3164
3177
|
);
|
|
3165
3178
|
runOnlyForDeploymentPostprocessing = 0;
|
|
@@ -3229,6 +3242,7 @@
|
|
|
3229
3242
|
716E0BCF1E917E810087A825 /* NSString+FBXMLSafeString.m in Sources */,
|
|
3230
3243
|
EE158ACD1CBD456F00A3E3F0 /* FBUnknownCommands.m in Sources */,
|
|
3231
3244
|
EE158AC51CBD456F00A3E3F0 /* FBOrientationCommands.m in Sources */,
|
|
3245
|
+
716F0DA32A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m in Sources */,
|
|
3232
3246
|
71D475C42538F5A8008D9401 /* XCUIApplicationProcess+FBQuiescence.m in Sources */,
|
|
3233
3247
|
641EE7082240CDEB00173FCB /* XCUIElement+FBTVFocuse.m in Sources */,
|
|
3234
3248
|
71E75E6F254824230099FC87 /* XCUIElementQuery+FBHelpers.m in Sources */,
|
|
@@ -3346,6 +3360,7 @@
|
|
|
3346
3360
|
7139145C1DF01A12005896C2 /* NSExpressionFBFormatTests.m in Sources */,
|
|
3347
3361
|
71A224E81DE326C500844D55 /* NSPredicateFBFormatTests.m in Sources */,
|
|
3348
3362
|
EE6A892B1D0B25820083E92B /* FBApplicationDouble.m in Sources */,
|
|
3363
|
+
716F0DA62A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m in Sources */,
|
|
3349
3364
|
EE6A892D1D0B2AF40083E92B /* FBErrorBuilderTests.m in Sources */,
|
|
3350
3365
|
712A0C851DA3E459007D02E5 /* FBXPathTests.m in Sources */,
|
|
3351
3366
|
ADBC39981D07842800327304 /* XCUIElementDouble.m in Sources */,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <Foundation/Foundation.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface NSString (FBUtf8SafeString)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
Converts the string, so it could be properly represented in UTF-8 encoding. All non-encodable characters are replaced with
|
|
18
|
+
the given `replacement`
|
|
19
|
+
|
|
20
|
+
@param replacement The character to use a a replacement for the lossy encoding
|
|
21
|
+
@returns Either the same string or a string with non-encodable chars replaced
|
|
22
|
+
*/
|
|
23
|
+
- (instancetype)fb_utf8SafeStringWithReplacement:(unichar)replacement;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
@interface NSDictionary (FBUtf8SafeDictionary)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Converts the dictionary, so it could be properly represented in UTF-8 encoding. All non-encodable characters
|
|
31
|
+
in string values are replaced with the Unocde question mark characters. Nested dictionaries and arrays are
|
|
32
|
+
processed recursively.
|
|
33
|
+
|
|
34
|
+
@returns Either the same dictionary or a dictionary with non-encodable chars in string values replaced
|
|
35
|
+
*/
|
|
36
|
+
- (instancetype)fb_utf8SafeDictionary;
|
|
37
|
+
|
|
38
|
+
@end
|
|
39
|
+
|
|
40
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import "NSDictionary+FBUtf8SafeDictionary.h"
|
|
11
|
+
|
|
12
|
+
const unichar REPLACER = 0xfffd;
|
|
13
|
+
|
|
14
|
+
@implementation NSString (FBUtf8SafeString)
|
|
15
|
+
|
|
16
|
+
- (instancetype)fb_utf8SafeStringWithReplacement:(unichar)replacement
|
|
17
|
+
{
|
|
18
|
+
if ([self canBeConvertedToEncoding:NSUTF8StringEncoding]) {
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
|
23
|
+
NSString *convertedString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
24
|
+
NSMutableString *result = [NSMutableString string];
|
|
25
|
+
NSString *replacementStr = [NSString stringWithCharacters:&replacement length:1];
|
|
26
|
+
NSUInteger originalIdx = 0;
|
|
27
|
+
NSUInteger convertedIdx = 0;
|
|
28
|
+
while (originalIdx < [self length] && convertedIdx < [convertedString length]) {
|
|
29
|
+
unichar originalChar = [self characterAtIndex:originalIdx];
|
|
30
|
+
unichar convertedChar = [convertedString characterAtIndex:convertedIdx];
|
|
31
|
+
|
|
32
|
+
if (originalChar == convertedChar) {
|
|
33
|
+
[result appendString:[NSString stringWithCharacters:&originalChar length:1]];
|
|
34
|
+
originalIdx++;
|
|
35
|
+
convertedIdx++;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
while (originalChar != convertedChar && originalIdx < [self length]) {
|
|
40
|
+
[result appendString:replacementStr];
|
|
41
|
+
originalChar = [self characterAtIndex:++originalIdx];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return result.copy;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@end
|
|
48
|
+
|
|
49
|
+
@implementation NSArray (FBUtf8SafeArray)
|
|
50
|
+
|
|
51
|
+
- (instancetype)fb_utf8SafeArray
|
|
52
|
+
{
|
|
53
|
+
NSMutableArray *result = [NSMutableArray array];
|
|
54
|
+
for (id item in self) {
|
|
55
|
+
if ([item isKindOfClass:NSString.class]) {
|
|
56
|
+
[result addObject:[(NSString *)item fb_utf8SafeStringWithReplacement:REPLACER]];
|
|
57
|
+
} else if ([item isKindOfClass:NSDictionary.class]) {
|
|
58
|
+
[result addObject:[(NSDictionary *)item fb_utf8SafeDictionary]];
|
|
59
|
+
} else if ([item isKindOfClass:NSArray.class]) {
|
|
60
|
+
[result addObject:[(NSArray *)item fb_utf8SafeArray]];
|
|
61
|
+
} else {
|
|
62
|
+
[result addObject:item];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result.copy;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@end
|
|
69
|
+
|
|
70
|
+
@implementation NSDictionary (FBUtf8SafeDictionary)
|
|
71
|
+
|
|
72
|
+
- (instancetype)fb_utf8SafeDictionary
|
|
73
|
+
{
|
|
74
|
+
NSMutableDictionary *result = [self mutableCopy];
|
|
75
|
+
for (id key in self) {
|
|
76
|
+
id value = result[key];
|
|
77
|
+
if ([value isKindOfClass:NSString.class]) {
|
|
78
|
+
result[key] = [(NSString *)value fb_utf8SafeStringWithReplacement:REPLACER];
|
|
79
|
+
} else if ([value isKindOfClass:NSArray.class]) {
|
|
80
|
+
result[key] = [(NSArray *)value fb_utf8SafeArray];
|
|
81
|
+
} else if ([value isKindOfClass:NSDictionary.class]) {
|
|
82
|
+
result[key] = [(NSDictionary *)value fb_utf8SafeDictionary];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result.copy;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@end
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
#import "FBResponseJSONPayload.h"
|
|
11
11
|
|
|
12
|
+
#import "FBLogger.h"
|
|
13
|
+
#import "NSDictionary+FBUtf8SafeDictionary.h"
|
|
12
14
|
#import "RouteResponse.h"
|
|
13
15
|
|
|
14
16
|
@interface FBResponseJSONPayload ()
|
|
@@ -43,6 +45,13 @@
|
|
|
43
45
|
options:NSJSONWritingPrettyPrinted
|
|
44
46
|
error:&error];
|
|
45
47
|
NSCAssert(jsonData, @"Valid JSON must be responded, error of %@", error);
|
|
48
|
+
if (nil == [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]) {
|
|
49
|
+
[FBLogger log:@"The incoming data cannot be encoded to UTF-8 JSON. Applying lossy conversion as a workaround."];
|
|
50
|
+
jsonData = [NSJSONSerialization dataWithJSONObject:[self.dictionary fb_utf8SafeDictionary]
|
|
51
|
+
options:NSJSONWritingPrettyPrinted
|
|
52
|
+
error:&error];
|
|
53
|
+
}
|
|
54
|
+
NSCAssert(jsonData, @"Valid JSON must be responded, error of %@", error);
|
|
46
55
|
[response setHeader:@"Content-Type" value:@"application/json;charset=UTF-8"];
|
|
47
56
|
[response setStatusCode:self.httpStatusCode];
|
|
48
57
|
[response respondWithData:jsonData];
|
|
@@ -49,6 +49,11 @@
|
|
|
49
49
|
|
|
50
50
|
- (void)testSimpleScroll
|
|
51
51
|
{
|
|
52
|
+
if (SYSTEM_VERSION_LESS_THAN(@"16.0")) {
|
|
53
|
+
// This test is unstable in CI env
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
FBAssertVisibleCell(@"0");
|
|
53
58
|
FBAssertVisibleCell(@"10");
|
|
54
59
|
[self.scrollView fb_scrollDownByNormalizedDistance:1.0];
|
|
@@ -82,6 +87,11 @@
|
|
|
82
87
|
|
|
83
88
|
- (void)testNativeFarScrollToVisible
|
|
84
89
|
{
|
|
90
|
+
if (SYSTEM_VERSION_LESS_THAN(@"16.0")) {
|
|
91
|
+
// This test is unstable in CI env
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
NSString *cellName = @"80";
|
|
86
96
|
NSError *error;
|
|
87
97
|
FBAssertInvisibleCell(cellName);
|
|
@@ -100,6 +110,12 @@
|
|
|
100
110
|
[element fb_scrollToVisibleWithError:&error];
|
|
101
111
|
XCTAssertNil(error);
|
|
102
112
|
XCTAssertTrue(element.fb_isVisible);
|
|
113
|
+
|
|
114
|
+
if (SYSTEM_VERSION_LESS_THAN(@"16.0")) {
|
|
115
|
+
// This test is unstable in CI env
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
103
119
|
[element tap];
|
|
104
120
|
XCTAssertTrue(element.wdSelected);
|
|
105
121
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <XCTest/XCTest.h>
|
|
11
|
+
|
|
12
|
+
#import "NSDictionary+FBUtf8SafeDictionary.h"
|
|
13
|
+
|
|
14
|
+
@interface NSDictionaryFBUtf8SafeTests : XCTestCase
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation NSDictionaryFBUtf8SafeTests
|
|
18
|
+
|
|
19
|
+
- (void)testEmptySafeDictConversion
|
|
20
|
+
{
|
|
21
|
+
NSDictionary *d = @{};
|
|
22
|
+
XCTAssertEqualObjects(d, d.fb_utf8SafeDictionary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
- (void)testNonEmptySafeDictConversion
|
|
26
|
+
{
|
|
27
|
+
NSDictionary *d = @{
|
|
28
|
+
@"1": @[@3, @4],
|
|
29
|
+
@"5": @{@"6": @7, @"8": @9},
|
|
30
|
+
@"10": @"11"
|
|
31
|
+
};
|
|
32
|
+
XCTAssertEqualObjects(d, d.fb_utf8SafeDictionary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@end
|