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
4 changes: 2 additions & 2 deletions Sources/CustomDump/Diff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public func diff<T>(_ lhs: T, _ rhs: T, format: DiffFormat = .default) -> String
}
return lhs.key == rhs.key
},
areInIncreasingOrder: T.self is _UnorderedCollection.Type
areInIncreasingOrder: lhsMirror.subjectType is _UnorderedCollection.Type
? {
guard
let lhs = $0.value as? (key: AnyHashable, value: Any),
Expand Down Expand Up @@ -483,7 +483,7 @@ public func diff<T>(_ lhs: T, _ rhs: T, format: DiffFormat = .default) -> String
areEquivalent: {
isIdentityEqual($0.value, $1.value) || isMirrorEqual($0.value, $1.value)
},
areInIncreasingOrder: T.self is _UnorderedCollection.Type
areInIncreasingOrder: lhsMirror.subjectType is _UnorderedCollection.Type
? {
_customDump($0.value, name: nil, indent: 0, isRoot: false, maxDepth: 1)
< _customDump($1.value, name: nil, indent: 0, isRoot: false, maxDepth: 1)
Expand Down
4 changes: 2 additions & 2 deletions Sources/CustomDump/Dump.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func _customDump<T, TargetStream>(
dumpChildren(
of: mirror,
prefix: "[", suffix: "]",
by: T.self is _UnorderedCollection.Type
by: mirror.subjectType is _UnorderedCollection.Type
? {
guard
let (lhsKey, _) = $0.value as? (key: AnyHashable, value: Any),
Expand Down Expand Up @@ -262,7 +262,7 @@ func _customDump<T, TargetStream>(
dumpChildren(
of: mirror,
prefix: "Set([", suffix: "])",
by: T.self is _UnorderedCollection.Type
by: mirror.subjectType is _UnorderedCollection.Type
? {
_customDump($0.value, name: nil, indent: 0, isRoot: false, maxDepth: 1)
< _customDump($1.value, name: nil, indent: 0, isRoot: false, maxDepth: 1)
Expand Down
24 changes: 24 additions & 0 deletions Tests/CustomDumpTests/DumpTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,31 @@ final class DumpTests: XCTestCase {
]
"""
)
}

func testDictionary_Nested() {
struct NestedDictionary {
let content: [String: Int]
}

XCTAssertNoDifference(
"""
DumpTests.NestedDictionary(
content: [
"a": 5,
"b": 9,
"c": 1,
"d": -3,
"e": 12
]
)
""",
String(
customDumping: NestedDictionary(
content: ["a": 5, "b": 9, "c": 1, "d": -3, "e": 12]
)
)
)
}

func testEnum() {
Expand Down