Skip to content

Commit 2196944

Browse files
committed
[SR-7076] Codable tests for ContiguousArray
<https://bugs.swift.org/browse/SR-7076> Follow-up to swiftlang/swift#20715
1 parent 11a1945 commit 2196944

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Darwin/Foundation-swiftoverlay-Tests/CodableTests.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
1+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
22
// Licensed under Apache License v2.0 with Runtime Library Exception
33
//
44
// See https://swift.org/LICENSE.txt for license information
@@ -371,6 +371,26 @@ class TestCodable : TestCodableSuper {
371371
expectEqual(value.lowerBound, decoded.lowerBound, "\(#file):\(#line): Decoded ClosedRange lowerBound <\(debugDescription(decoded))> not equal to original <\(debugDescription(value))>")
372372
}
373373

374+
// MARK: - ContiguousArray
375+
lazy var contiguousArrayValues: [Int : ContiguousArray<String>] = [
376+
#line : [],
377+
#line : ["foo"],
378+
#line : ["foo", "bar"],
379+
#line : ["foo", "bar", "baz"],
380+
]
381+
382+
func test_ContiguousArray_JSON() {
383+
for (testLine, contiguousArray) in contiguousArrayValues {
384+
expectRoundTripEqualityThroughJSON(for: contiguousArray, lineNumber: testLine)
385+
}
386+
}
387+
388+
func test_ContiguousArray_Plist() {
389+
for (testLine, contiguousArray) in contiguousArrayValues {
390+
expectRoundTripEqualityThroughPlist(for: contiguousArray, lineNumber: testLine)
391+
}
392+
}
393+
374394
// MARK: - DateComponents
375395
lazy var dateComponents: Set<Calendar.Component> = [
376396
.era, .year, .month, .day, .hour, .minute, .second, .nanosecond,
@@ -853,6 +873,8 @@ var tests = [
853873
"test_CGVector_Plist" : TestCodable.test_CGVector_Plist,
854874
"test_ClosedRange_JSON" : TestCodable.test_ClosedRange_JSON,
855875
"test_ClosedRange_Plist" : TestCodable.test_ClosedRange_Plist,
876+
"test_ContiguousArray_JSON" : TestCodable.test_ContiguousArray_JSON,
877+
"test_ContiguousArray_Plist" : TestCodable.test_ContiguousArray_Plist,
856878
"test_DateComponents_JSON" : TestCodable.test_DateComponents_JSON,
857879
"test_DateComponents_Plist" : TestCodable.test_DateComponents_Plist,
858880
"test_Decimal_JSON" : TestCodable.test_Decimal_JSON,

0 commit comments

Comments
 (0)