@@ -1390,22 +1390,26 @@ final class IssueTests: XCTestCase {
1390
1390
@Suite ( " Issue Codable Conformance Tests " )
1391
1391
struct IssueCodingTests {
1392
1392
1393
+ private static let issueKinds : [ Issue . Kind ] = [
1394
+ Issue . Kind. apiMisused,
1395
+ Issue . Kind. confirmationMiscounted ( actual: 13 , expected: 42 ) ,
1396
+ Issue . Kind. errorCaught ( NSError ( domain: " Domain " , code: 13 , userInfo: [ " UserInfoKey " : " UserInfoValue " ] ) ) ,
1397
+ Issue . Kind. expectationFailed ( Expectation ( evaluatedExpression: . __fromSyntaxNode( " abc " ) , isPassing: true , isRequired: true , sourceLocation: SourceLocation ( ) ) ) ,
1398
+ Issue . Kind. knownIssueNotRecorded,
1399
+ Issue . Kind. system,
1400
+ Issue . Kind. timeLimitExceeded ( timeLimitComponents: ( 13 , 42 ) ) ,
1401
+ Issue . Kind. unconditional,
1402
+ ]
1403
+
1393
1404
@Test ( " Codable " ,
1394
- arguments: [
1395
- Issue . Kind. apiMisused,
1396
- Issue . Kind. confirmationMiscounted ( actual: 13 , expected: 42 ) ,
1397
- Issue . Kind. errorCaught ( NSError ( domain: " Domain " , code: 13 , userInfo: [ " UserInfoKey " : " UserInfoValue " ] ) ) ,
1398
- Issue . Kind. expectationFailed ( Expectation ( evaluatedExpression: . __fromSyntaxNode( " abc " ) , isPassing: true , isRequired: true , sourceLocation: SourceLocation ( ) ) ) ,
1399
- Issue . Kind. knownIssueNotRecorded,
1400
- Issue . Kind. system,
1401
- Issue . Kind. timeLimitExceeded ( timeLimitComponents: ( 13 , 42 ) ) ,
1402
- Issue . Kind. unconditional,
1403
- ]
1405
+ arguments: issueKinds
1404
1406
)
1405
1407
func testCodable( issueKind: Issue . Kind ) async throws {
1406
- let issue = Issue ( kind: issueKind,
1407
- comments: [ " Comment " ] ,
1408
- sourceContext: SourceContext ( backtrace: Backtrace . current ( ) , sourceLocation: SourceLocation ( ) ) )
1408
+ let issue = Issue (
1409
+ kind: issueKind,
1410
+ comments: [ " Comment " ] ,
1411
+ sourceContext: SourceContext ( backtrace: Backtrace . current ( ) , sourceLocation: SourceLocation ( ) )
1412
+ )
1409
1413
let issueSnapshot = Issue . Snapshot ( snapshotting: issue)
1410
1414
let decoded = try JSON . encodeAndDecode ( issueSnapshot)
1411
1415
@@ -1479,4 +1483,19 @@ struct IssueCodingTests {
1479
1483
#expect( issueSnapshot. sourceLocation == updatedSourceLocation)
1480
1484
#expect( issueSnapshot. sourceContext. sourceLocation == updatedSourceLocation)
1481
1485
}
1486
+
1487
+ @Test ( " Custom descriptions are the same " ,
1488
+ arguments: issueKinds
1489
+ )
1490
+ func customDescription( issueKind: Issue . Kind ) async throws {
1491
+ let issue = Issue (
1492
+ kind: issueKind,
1493
+ comments: [ " Comment " ] ,
1494
+ sourceContext: SourceContext ( backtrace: Backtrace . current ( ) , sourceLocation: SourceLocation ( ) )
1495
+ )
1496
+ let issueSnapshot = Issue . Snapshot ( snapshotting: issue)
1497
+
1498
+ #expect( String ( describing: issueSnapshot) == String ( describing: issue) )
1499
+ #expect( String ( reflecting: issueSnapshot) == String ( reflecting: issue) )
1500
+ }
1482
1501
}
0 commit comments