Skip to content
/ RBBJSON Public

Commit d6381bd

Browse files
committed
Fix tests
1 parent d73682c commit d6381bd

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Sources/RBBJSON/RBBJSON.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,14 @@ public enum RBBJSON: Hashable, Codable, Sendable {
133133
}
134134
}
135135

136+
/// The JSON value as a sequence.
136137
public var ƒ: some Sequence<RBBJSON> {
137-
Self.values(self)
138+
switch self {
139+
case let .object(object): Array(object.values).sortedIfDebug
140+
case let .array(array): array
141+
case .null: Array<RBBJSON>()
142+
default: [self]
143+
}
138144
}
139145
}
140146

Tests/RBBJSONTests/READMETests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ final class READMETests: XCTestCase {
231231
"Sayings of the Century",
232232
"Sword of Honour"
233233
])
234+
RBBAssertEqual(json.store.book[999].title.ƒ.compactMap(String.init), [
235+
])
234236

235237
RBBAssertEqual(json.store.book[0]["invalid Property"].ƒ.compactMap(String.init), [])
236238
RBBAssertEqual(json.store.book[0, 1]["invalid Property"].ƒ.compactMap(String.init), [])
237-
238239
}
239240
}

0 commit comments

Comments
 (0)