A fast, safe, and efficient CBOR serialization library for Swift on any platform. swiftpackageindex.com/thecoolwinter/CBOR/1.1.1/documentation/cbor
atproto swift cbor

Make Tests Compatible with Swift 6.0

+9 -9
+2 -2
.github/workflows/ci.yml
··· 22 22 name: Testing CBOR (ubuntu) 23 23 needs: swiftlint 24 24 runs-on: ubuntu-latest 25 - container: swift:6.2-noble 25 + container: swift:6.0-noble 26 26 steps: 27 27 - name: Checkout repository 28 28 uses: actions/checkout@v5 ··· 56 56 uses: actions/checkout@v5 57 57 - uses: swift-actions/setup-swift@next 58 58 with: 59 - swift-version: "6.2" 59 + swift-version: "6.0" 60 60 - name: Restore .build 61 61 id: "restore-build" 62 62 uses: actions/cache/restore@v4
+2 -2
Sources/ProfilingHelper/Profiling.swift
··· 107 107 108 108 func data() throws { 109 109 try time { 110 - for _ in 0..<1_000_000 { 110 + for _ in 0..<1000 { 111 111 blackhole(try CBOREncoder().encode(Data([0x01, 0x02, 0x03, 0x04]))) 112 112 } 113 113 } _: { 114 - for _ in 0..<1_000_000 { 114 + for _ in 0..<1000 { 115 115 blackhole(try JSONEncoder().encode(Data([0x01, 0x02, 0x03, 0x04]))) 116 116 } 117 117 }
+4 -4
Tests/CBORTests/DAGCBORTests.swift
··· 31 31 @Suite 32 32 struct DAGCBORTests { 33 33 @Test 34 - func `Custom CID Type Encoded Correctly`() throws { 34 + func customCIDTypeEncodedCorrectly() throws { 35 35 let cid = CID(data: [0, 1, 2, 3, 4, 5, 6, 7, 8]) 36 36 let data = try DAGCBOREncoder().encode(cid).hexString() 37 37 #expect(data == "d82a4a00000102030405060708") 38 38 } 39 39 40 40 @Test 41 - func `Known valid base256 encoded ID`() throws { 41 + func knownValidBase256EncodedID() throws { 42 42 let cid = CID(data: "017112209fe4ccc6de16724f3a30c7e8f254f3c6471986acb1f8d8cf8e96ce2ad7dbe7fb".asHexData()) 43 43 let data = try DAGCBOREncoder().encode(cid).hexString() 44 44 let expected = "d82a582500017112209FE4CCC6DE16724F3A30C7E8F254F3C6471986ACB1F8D8CF8E96CE2AD7DBE7FB".lowercased() ··· 139 139 } 140 140 141 141 @Test(arguments: [Double.nan, Double.infinity, -Double.infinity]) 142 - func `Nan and Infinite throw errors`(value: Double) throws { 142 + func NanAndInfiniteThrowErrors(value: Double) throws { 143 143 #expect(throws: EncodingError.self) { 144 144 try DAGCBOREncoder().encode(value) 145 145 } ··· 284 284 } 285 285 286 286 @Test 287 - func `Duplicate keys are deduplicated on encode`() throws { 287 + func duplicateKeysAreDeduplicatedOnEncode() throws { 288 288 let encoder = DAGCBOREncoder() 289 289 struct Mock: Encodable { 290 290 enum CodingKeys: String, CodingKey {
+1 -1
Tests/CBORTests/EncodableTests.swift
··· 250 250 } 251 251 252 252 @Test 253 - func `Duplicate keys are deduplicated on encode`() throws { 253 + func duplicateKeysAreDeduplicatedOnEncode() throws { 254 254 let encoder = CBOREncoder() 255 255 struct Mock: Encodable { 256 256 enum CodingKeys: String, CodingKey {