You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [SR-2151]NSJSONSerialization.data produces illegal JSON code
NSJSONSerialization.data(withJSONObject:options) produces illegal JSON code
https://bugs.swift.org/browse/SR-2151
* decoupling formatting logic and lazy loading formatter
1. moved format logic out of NSNumber and in to NSJSonSerialization
2. lazy load the formatter to be instantiated if needed
3. create a single format string to work with all formats since we are lazy loading a single formatter
* fix build break
update to latest master
by removing casting
and updating syntax
if num.doubleValue.isInfinite || num.doubleValue.isNaN {
315
325
throwNSError(domain: NSCocoaErrorDomain, code:NSCocoaError.PropertyListReadCorruptError.rawValue, userInfo:["NSDebugDescription":"Number cannot be infinity or NaN"])
316
326
}
317
327
318
328
// Cannot detect type information (e.g. bool) as there is no objCType property on NSNumber in Swift
XCTAssertEqual(str!,"{\"\(param.0)\":\(NSString(string:param.0).intValue)}","expect that serialized value should not contain trailing zero or decimal as they are whole numbers ")
694
+
}
695
+
}
696
+
697
+
func excecute_testWholeNumbersWithIntInput(){
698
+
foriin-10..<10{
699
+
letiStr="\(i)"
700
+
lettestDict=[iStr : i]
701
+
letstr=try?trySerialize(testDict)
702
+
XCTAssertEqual(str!,"{\"\(iStr)\":\(i)}","expect that serialized value should not contain trailing zero or decimal as they are whole numbers ")
0 commit comments