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
"JSON encoder produced one or more newline characters while encoding an event to JSON. Please file a bug report at https://github.com/swiftlang/swift-testing/issues/new",
585
-
options:.for(.stderr)
586
-
)
587
-
#if SWT_TARGET_OS_APPLE
588
-
try?FileHandle.stderr.write(message)
589
-
#else
590
-
print(message)
591
-
#endif
592
-
#endif
593
-
594
-
// Remove the newline characters to conform to JSON lines specification.
"JSON encoder produced one or more newline characters while encoding an event to JSON. Please file a bug report at https://github.com/swiftlang/swift-testing/issues/new",
27
+
options:.for(.stderr)
28
+
)
29
+
#if SWT_TARGET_OS_APPLE
30
+
try?FileHandle.stderr.write(message)
31
+
#else
32
+
print(message)
33
+
#endif
34
+
#endif
35
+
36
+
// Remove the newline characters to conform to JSON lines specification.
37
+
varjson=Array(json)
38
+
json.removeAll(where: \.isASCIINewline)
39
+
try json.withUnsafeBytes(eventHandler)
40
+
}else{
41
+
// No newlines found, no need to copy the buffer.
42
+
tryeventHandler(json)
43
+
}
44
+
}
45
+
13
46
/// Create an event handler that encodes events as JSON and forwards them to
14
47
/// an ABI-friendly event handler.
15
48
///
16
49
/// - Parameters:
50
+
/// - encodeAsJSONLines: Whether or not to ensure JSON passed to
51
+
/// `eventHandler` is encoded as JSON Lines (i.e. that it does not contain
52
+
/// extra newlines.)
17
53
/// - eventHandler: The event handler to forward events to. See
18
54
/// ``ABIv0/EntryPoint-swift.typealias`` for more information.
19
55
///
@@ -27,10 +63,17 @@ extension ABIv0.Record {
27
63
/// performs additional postprocessing before writing JSON data to ensure it
0 commit comments