Skip to content

Commit eced6e0

Browse files
committed
Gather source location from callers to AssertEqualPaths
1 parent 4310316 commit eced6e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Tests/FoundationEssentialsTests/PropertyListEncoderTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,31 +1584,31 @@ data1 = <7465
15841584

15851585

15861586
// MARK: - Helper Global Functions
1587-
func AssertEqualPaths(_ lhs: [CodingKey], _ rhs: [CodingKey], _ prefix: String) {
1587+
func AssertEqualPaths(_ lhs: [CodingKey], _ rhs: [CodingKey], _ prefix: String, sourceLocation: SourceLocation = #_sourceLocation) {
15881588
if lhs.count != rhs.count {
1589-
Issue.record("\(prefix) [CodingKey].count mismatch: \(lhs.count) != \(rhs.count)")
1589+
Issue.record("\(prefix) [CodingKey].count mismatch: \(lhs.count) != \(rhs.count)", sourceLocation: sourceLocation)
15901590
return
15911591
}
15921592

15931593
for (key1, key2) in zip(lhs, rhs) {
15941594
switch (key1.intValue, key2.intValue) {
15951595
case (.none, .none): break
15961596
case (.some(let i1), .none):
1597-
Issue.record("\(prefix) CodingKey.intValue mismatch: \(type(of: key1))(\(i1)) != nil")
1597+
Issue.record("\(prefix) CodingKey.intValue mismatch: \(type(of: key1))(\(i1)) != nil", sourceLocation: sourceLocation)
15981598
return
15991599
case (.none, .some(let i2)):
1600-
Issue.record("\(prefix) CodingKey.intValue mismatch: nil != \(type(of: key2))(\(i2))")
1600+
Issue.record("\(prefix) CodingKey.intValue mismatch: nil != \(type(of: key2))(\(i2))", sourceLocation: sourceLocation)
16011601
return
16021602
case (.some(let i1), .some(let i2)):
16031603
guard i1 == i2 else {
1604-
Issue.record("\(prefix) CodingKey.intValue mismatch: \(type(of: key1))(\(i1)) != \(type(of: key2))(\(i2))")
1604+
Issue.record("\(prefix) CodingKey.intValue mismatch: \(type(of: key1))(\(i1)) != \(type(of: key2))(\(i2))", sourceLocation: sourceLocation)
16051605
return
16061606
}
16071607

16081608
break
16091609
}
16101610

1611-
#expect(key1.stringValue == key2.stringValue, "\(prefix) CodingKey.stringValue mismatch: \(type(of: key1))('\(key1.stringValue)') != \(type(of: key2))('\(key2.stringValue)')")
1611+
#expect(key1.stringValue == key2.stringValue, "\(prefix) CodingKey.stringValue mismatch: \(type(of: key1))('\(key1.stringValue)') != \(type(of: key2))('\(key2.stringValue)')", sourceLocation: sourceLocation)
16121612
}
16131613
}
16141614

0 commit comments

Comments
 (0)