Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion Sources/CustomDump/Conformances/KeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ extension AnyKeyPath: CustomDumpStringConvertible {
}
return name
#else
return typeName(Self.self, genericsAbbreviated: false)
return """
\(typeName(Self.self))<\
\(typeName(Self.rootType)), \
\(typeName(Self.valueType,genericsAbbreviated: false))>
"""
#endif
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/CustomDump/Internal/AnyType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ func typeName(
) -> String {
var name = _typeName(type, qualified: qualified)
.replacingOccurrences(
of: #"\w+\.(\w+)"#,
with: "$1",
of: #"\(unknown context at \$[[:xdigit:]]+\)\."#,
with: "",
options: .regularExpression
)
.replacingOccurrences(
of: #"\(unknown context at \$[[:xdigit:]]+\)\."#,
with: "",
of: #"\w+\.([\w.]+)"#,
with: "$1",
options: .regularExpression
)
if genericsAbbreviated {
Expand Down
21 changes: 21 additions & 0 deletions Tests/CustomDumpTests/DumpTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ final class DumpTests: XCTestCase {
Foo.Bar.self
"""
)

struct Feature {
struct State {}
}
dump = ""
customDump(Feature.State.self, to: &dump)
XCTAssertNoDifference(
dump,
"""
DumpTests.Feature.State.self
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the change, this dumps DumpTests.State.self.

"""
)

dump = ""
customDump((x: Double, y: Double).self, to: &dump)
XCTAssertNoDifference(
dump,
"""
(x: Double, y: Double).self
"""
)
}

func testClass() {
Expand Down