Skip to content

Commit

Permalink
Fix 5.9 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Jul 12, 2023
1 parent a146af9 commit 4a87bb7
Showing 1 changed file with 57 additions and 64 deletions.
121 changes: 57 additions & 64 deletions Tests/CustomDumpTests/DumpTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -709,71 +709,64 @@ final class DumpTests: XCTestCase {

func testKeyPath() {
var dump = ""
#if swift(>=5.9)
if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
dump = ""
customDump(\UserClass.name, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\UserClass.name
"""#
)

dump = ""
customDump(\Pair.driver.name, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\Pair.driver.name
"""#
)

dump = ""
customDump(\User.name.count, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\User.name.count
"""#
)

// NB: This code path marks the expectation of relying on SE-0369's
// `AnyKeyPath.debugDescription`, which currently has a crash related to dynamic member lookup:
// https://github.com/apple/swift/issues/64865
//
// #if swift(>=5.8)
// if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
// dump = ""
// customDump(\UserClass.name, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \UserClass.name
// """#
// )
//
// dump = ""
// customDump(\Pair.driver.name, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \Pair.driver.name
// """#
// )
//
// dump = ""
// customDump(\User.name.count, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \User.name.count
// """#
// )
//
// dump = ""
// customDump(\(x: Double, y: Double).x, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \(x: Double, y: Double).x
// """#
// )
//
// dump = ""
// customDump(\Item.$isInStock, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \Item.$isInStock
// """#
// )
//
// // NB: This currently crashes when using Swift's `debugDescription`:
// // https://github.com/apple/swift/issues/64865
// dump = ""
// customDump(\Wrapped<String>.count, to: &dump)
// XCTAssertNoDifference(
// dump,
// #"""
// \Wrapped.count
// """#
// )
// return
// }
// #endif
dump = ""
customDump(\(x: Double, y: Double).x, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\(x: Double, y: Double).x
"""#
)

dump = ""
customDump(\Item.$isInStock, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\Item.$isInStock
"""#
)

dump = ""
customDump(\Wrapped<String>.count, to: &dump)
XCTAssertNoDifference(
dump,
#"""
\Wrapped<String>.subscript(dynamicMember: <unknown>)
"""#
)
return
}
#endif
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
// Run twice to exercise cached lookup
for _ in 1...2 {
Expand Down

0 comments on commit 4a87bb7

Please sign in to comment.