Skip to content

[SR-7076] Codable tests for ContiguousArray #22209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion test/stdlib/CodableTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -371,6 +371,26 @@ class TestCodable : TestCodableSuper {
expectEqual(value.lowerBound, decoded.lowerBound, "\(#file):\(#line): Decoded ClosedRange lowerBound <\(debugDescription(decoded))> not equal to original <\(debugDescription(value))>")
}

// MARK: - ContiguousArray
lazy var contiguousArrayValues: [Int : ContiguousArray<String>] = [
#line : [],
#line : ["foo"],
#line : ["foo", "bar"],
#line : ["foo", "bar", "baz"],
]

func test_ContiguousArray_JSON() {
for (testLine, contiguousArray) in contiguousArrayValues {
expectRoundTripEqualityThroughJSON(for: contiguousArray, lineNumber: testLine)
}
}

func test_ContiguousArray_Plist() {
for (testLine, contiguousArray) in contiguousArrayValues {
expectRoundTripEqualityThroughPlist(for: contiguousArray, lineNumber: testLine)
}
}

// MARK: - DateComponents
lazy var dateComponents: Set<Calendar.Component> = [
.era, .year, .month, .day, .hour, .minute, .second, .nanosecond,
Expand Down Expand Up @@ -853,6 +873,8 @@ var tests = [
"test_CGVector_Plist" : TestCodable.test_CGVector_Plist,
"test_ClosedRange_JSON" : TestCodable.test_ClosedRange_JSON,
"test_ClosedRange_Plist" : TestCodable.test_ClosedRange_Plist,
"test_ContiguousArray_JSON" : TestCodable.test_ContiguousArray_JSON,
"test_ContiguousArray_Plist" : TestCodable.test_ContiguousArray_Plist,
"test_DateComponents_JSON" : TestCodable.test_DateComponents_JSON,
"test_DateComponents_Plist" : TestCodable.test_DateComponents_Plist,
"test_Decimal_JSON" : TestCodable.test_Decimal_JSON,
Expand Down