@@ -77,4 +77,56 @@ - (void)testHexToStringWithNonPrintableCharacters {
77
77
XCTAssertEqualObjects ([NSString stringWithUTF8String: string], @" 52d04e1f" , @" " );
78
78
}
79
79
80
+ - (void )testRedactUUIDWithExpectedPattern {
81
+ const char * readonly = " CoreSimulator 704.12.1 - Device: iPhone SE (2nd generation) "
82
+ " (45D62CC2-CFB5-4E33-AB61-B0684627F1B6) - Runtime: iOS 13.4 (17E8260) - "
83
+ " DeviceType: iPhone SE (2nd generation)" ;
84
+ size_t len = strlen (readonly);
85
+ char message[len];
86
+ strcpy (message, readonly);
87
+
88
+ FIRCLSRedactUUID (message);
89
+
90
+ NSString * actual = [NSString stringWithUTF8String: message];
91
+ NSString * expected = @" CoreSimulator 704.12.1 - Device: iPhone SE (2nd generation) "
92
+ @" (********-****-****-****-************) - Runtime: iOS 13.4 (17E8260) - "
93
+ @" DeviceType: iPhone SE (2nd generation)" ;
94
+
95
+ XCTAssertEqualObjects (actual, expected);
96
+ }
97
+
98
+ - (void )testRedactUUIDWithMalformedPattern {
99
+ const char * readonly = " CoreSimulator 704.12.1 - Device: iPhone SE (2nd generation) "
100
+ " (45D62CC2-CFB5-4E33-AB61-B0684627F1B6" ;
101
+ size_t len = strlen (readonly);
102
+ char message[len];
103
+ strcpy (message, readonly);
104
+
105
+ FIRCLSRedactUUID (message);
106
+
107
+ NSString * actual = [NSString stringWithUTF8String: message];
108
+ NSString * expected = @" CoreSimulator 704.12.1 - Device: iPhone SE (2nd generation) "
109
+ @" (45D62CC2-CFB5-4E33-AB61-B0684627F1B6" ;
110
+
111
+ XCTAssertEqualObjects (actual, expected);
112
+ }
113
+
114
+ - (void )testRedactUUIDWithoutUUID {
115
+ const char * readonly = " Fatal error: file /Users/test/src/foo/bar/ViewController.swift, line 25" ;
116
+ size_t len = strlen (readonly);
117
+ char message[len];
118
+ strcpy (message, readonly);
119
+
120
+ FIRCLSRedactUUID (message);
121
+
122
+ NSString * actual = [NSString stringWithUTF8String: message];
123
+ NSString * expected = @" Fatal error: file /Users/test/src/foo/bar/ViewController.swift, line 25" ;
124
+
125
+ XCTAssertEqualObjects (actual, expected);
126
+ }
127
+
128
+ - (void )testRedactUUIDWithNull {
129
+ char * message = NULL ;
130
+ XCTAssertNoThrow (FIRCLSRedactUUID (message));
131
+ }
80
132
@end
0 commit comments