Skip to content

Commit e0655c7

Browse files
committed
PR changes
1 parent 782e79f commit e0655c7

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Sources/GRPCCore/Metadata.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ extension Metadata.Value: CustomStringConvertible {
508508
public var description: String {
509509
switch self {
510510
case .string(let stringValue):
511-
return stringValue
511+
return String(describing: stringValue)
512512
case .binary(let binaryValue):
513513
return String(describing: binaryValue)
514514
}
@@ -519,9 +519,9 @@ extension Metadata.Value: CustomDebugStringConvertible {
519519
public var debugDescription: String {
520520
switch self {
521521
case .string(let stringValue):
522-
return "\"\(stringValue)\""
522+
return String(reflecting: stringValue)
523523
case .binary(let binaryValue):
524-
return String(describing: binaryValue)
524+
return String(reflecting: binaryValue)
525525
}
526526
}
527527
}

Tests/GRPCCoreTests/MetadataTests.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,20 @@ struct MetadataTests {
317317

318318
@Suite("Description")
319319
struct Description {
320+
let metadata = Metadata([
321+
"key1": "value1",
322+
"key2": "value2",
323+
"key-bin": .binary([1, 2, 3]),
324+
])
325+
320326
@Test("Metadata")
321327
func describeMetadata() async throws {
322-
let metadata: Metadata = [
323-
"key1": "value1",
324-
"key2": "value2",
325-
"key-bin": .binary([1, 2, 3]),
326-
]
327-
328-
#expect("\(metadata)" == #"["key1": "value1", "key2": "value2", "key-bin": [1, 2, 3]]"#)
328+
#expect("\(self.metadata)" == #"["key1": "value1", "key2": "value2", "key-bin": [1, 2, 3]]"#)
329+
}
329330

330-
for (key, value) in metadata {
331+
@Test("Metadata.Value")
332+
func describeMetadataValue() async throws {
333+
for (key, value) in self.metadata {
331334
switch key {
332335
case "key1":
333336
#expect("\(value)" == "value1")

0 commit comments

Comments
 (0)