Commit Graph

24 Commits

Author SHA1 Message Date
Nate Cook
9265743adc Add validation to CollectionDifference decoder (#76876)
The `CollectionDifference` type has a few different invariants
that were not being validated when initializing using the type's
`Decodable` conformance, since the type was using the
autogenerated `Codable` implementation. This change provides
manual implementations of the `Encodable` and `Decodable`
requirements, and adds tests that validate the failure when trying
to decode invalid JSON for CollectionDifference (and a few other
types).
2024-10-11 17:23:55 -07:00
Nate Cook
89b9e48eae [stdlib] Implement Never conformance to Codable (#64899)
Proposed as SE-0396: Conform Never to Codable;
approved on 5/5/2023.
2023-05-09 13:10:10 -05:00
Allan Shortlidge
e34196df0b Fix tests that depended on availability for lazy vars. 2022-02-04 10:28:11 -08:00
Karoy Lorentey
5f65686cfc [test] Replace some more 9999 availabilities with SwiftStdlib 5.6 2021-11-02 20:43:35 -07:00
Morten Bek Ditlevsen
0251957ae3 [SE-0320] Added protocol CodingKeyRepresentable (#34458) 2021-10-30 11:33:42 +01:00
Nate Chandler
00f1c606ff [Test] Disabled several stdlib tests for back_deployment_runtime.
rdar://76568032
2021-04-13 15:42:33 -07:00
Ben Rimmington
5be886f094 [stdlib] Reinstate some tests (#36072) 2021-03-02 18:13:04 +00:00
Xi Ge
b2b128caa0 test: temporarily disable several failing tests on CI. rdar://49026133 2019-03-19 11:18:05 -07:00
Ben Rimmington
7b2d43e53d [SR-7076] Codable tests for ContiguousArray
<https://bugs.swift.org/browse/SR-7076>

Follow-up to apple/swift#20715
2019-01-29 15:15:21 +00:00
Max Moiseev
3b6c6cc0a5 Merge pull request #19532 from dlbuckley/SR-8649_ranges_codable
SR-8649: Range types conform to Codable
2019-01-14 14:38:32 -08:00
Dale Buckley
dd394d9883 Added tests for codable Range types 2018-10-31 15:37:58 +00:00
Jordan Rose
21fe402c82 [test] Disable some tests on OS X 10.9 that require a newer Foundation 2018-10-03 16:54:38 -07:00
Itai Ferber
432603f85b Fix availability statements in CodableTests.swift 2018-06-29 10:58:48 -07:00
Sho Ikeda
b68be20e9d [test][gardening] Prefer os(macOS) over os(OSX) 2018-03-11 10:58:58 +09:00
Lance Parker
0661de22a2 [stdlib]Un-revert string comparison (#14694)
Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
2018-02-18 10:50:33 -08:00
Lance Parker
abe6a6d177 Revert string comparison (#14657) 2018-02-15 14:37:43 -08:00
Lance Parker
49bc1459ae Update string comparison tests 2018-02-14 15:44:11 -08:00
Mishal Shah
df070b858f Update swift master to build with Xcode 9 beta 6, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-08-22 11:52:50 -07:00
Itai Ferber
bf4a12568a Add Codable conformance for URLComponents
Adopt Codable on URLComponents and add associated unit tests
2017-08-03 14:28:18 -07:00
Itai Ferber
3c49e05249 Improve readability of Codable test failure
At the cost of slight test readability, improve the diagnostics on test failure by pointing to the specific test case which failed on round-trip failure.
2017-08-03 13:31:22 -07:00
Mishal Shah
64a77ca716 Update master to build with Xcode 9 beta 4, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-07-28 11:17:59 -07:00
Itai Ferber
9f7506f002 Allow application of JSON strategies in all cases
One of the limitations of not having conditional conformance at the
moment is that the implementation of `init(from:)` and `encode(to:)` on
types which require it is that failure to cast dependent types to
`Encodable` or `Decodable` is a runtime failure. There is no way to
statically guarantee that the wrapped type is `Encodable` or
`Decodable`.

As such, in those implementations, at best we can directly call
`(element as! Encodable).encode(to: encoder)`, or similar. However, this
encodes the element directly into an encoder, without giving the encoder
a chance to intercept the type. This is problematic for `JSONEncoder`
because it cannot apply a strategy if it doesn't get to intercept the
type.

This gives a temporary workaround for JSON strategies because of
internal Foundation knowledge.
2017-07-07 09:38:07 -07:00
Itai Ferber
fedf8e6908 Add Codable conformance to common CG types
Give custom Codable implementations for CGAffineTransform, CGPoint,
CGSize, CGRect, and CGVector, along with unit tests.
2017-06-19 17:23:11 -07:00
Itai Ferber
012ea9373b Add Codable conformance to common Foundation types
Add conformances + unit tests for

* CGFloat
* AffineTransform
* Calendar
* CharacterSet
* DateComponents
* DateInterval
* Decimal
* IndexPath
* IndexSet
* Locale
* Measurement
* NSRange
* PersonNameComponents
* TimeZone
* URL
* UUID

along with some unit tests for each.
2017-05-18 07:56:03 -07:00