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
A developer may rely on this formatting option to make a test deterministic. However, because the behavior differs across platforms, the test is not portable.
Test Case
import Foundation
letdictionary=["a":"a","B":"b"]letjsonEncoder=JSONEncoder()
jsonEncoder.outputFormatting =[.sortedKeys]letjsonBytes=try! jsonEncoder.encode(dictionary)letjsonString=String(decoding: jsonBytes, as:UTF8.self)print(jsonString)
Darwin Output
{"a":"a","B":"b"}
Non-Darwin Output
{"B":"b","a":"a"}
The text was updated successfully, but these errors were encountered:
The behavior of
JSONEncoder.OutputFormatting.sortedKeys
differs between the Darwin and non-Darwin implementation of Foundation.A developer may rely on this formatting option to make a test deterministic. However, because the behavior differs across platforms, the test is not portable.
Test Case
Darwin Output
Non-Darwin Output
The text was updated successfully, but these errors were encountered: