Skip to content

Commit 4616ca0

Browse files
committed
SequenceAllSatisfy is mapped to SequenceContainsWhere, and not SequenceAllSatisfy
This is a typo. SequenceAllSatisfy should map to SequenceAllSatisfy.
1 parent 439b692 commit 4616ca0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Sources/FoundationEssentials/Predicate/Archiving/PredicateCodableConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ extension PredicateCodableConfiguration {
391391
configuration.allowPartialType(PredicateExpressions.Range<PredicateExpressions.Value<Int>, PredicateExpressions.Value<Int>>.self, identifier: "PredicateExpressions.Range")
392392
configuration.allowPartialType(PredicateExpressions.SequenceContains<PredicateExpressions.Value<[Int]>, PredicateExpressions.Value<Int>>.self, identifier: "PredicateExpressions.SequenceContains")
393393
configuration.allowPartialType(PredicateExpressions.SequenceContainsWhere<PredicateExpressions.Value<[Int]>, PredicateExpressions.Value<Bool>>.self, identifier: "PredicateExpressions.SequenceContainsWhere")
394-
configuration.allowPartialType(PredicateExpressions.SequenceContainsWhere<PredicateExpressions.Value<[Int]>, PredicateExpressions.Value<Bool>>.self, identifier: "PredicateExpressions.SequenceAllSatisfy")
394+
configuration.allowPartialType(PredicateExpressions.SequenceAllSatisfy<PredicateExpressions.Value<[Int]>, PredicateExpressions.Value<Bool>>.self, identifier: "PredicateExpressions.SequenceAllSatisfy")
395395
configuration.allowPartialType(PredicateExpressions.SequenceStartsWith<PredicateExpressions.Value<[Int]>, PredicateExpressions.Value<[Int]>>.self, identifier: "PredicateExpressions.SequenceStartsWith")
396396
configuration.allowPartialType(PredicateExpressions.SequenceMaximum<PredicateExpressions.Value<[Int]>>.self, identifier: "PredicateExpressions.SequenceMaximum")
397397
configuration.allowPartialType(PredicateExpressions.SequenceMinimum<PredicateExpressions.Value<[Int]>>.self, identifier: "PredicateExpressions.SequenceMinimum")

Tests/FoundationEssentialsTests/PredicateCodableTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,19 @@ private struct PredicateCodableTests {
213213
}
214214
}
215215

216+
@Test func sequenceAllSatisfyRoundTrip() throws {
217+
let predicate = #Predicate<[Int]> {
218+
$0.allSatisfy { $0 > 0 }
219+
}
220+
221+
let decoded = try _encodeDecode(predicate, for: StandardConfig.self)
222+
223+
#expect(try predicate.evaluate([1, 2, 3]))
224+
#expect(try decoded.evaluate([1, 2, 3]))
225+
#expect(try predicate.evaluate([-1, 2, 3]) == decoded.evaluate([-1, 2, 3]))
226+
#expect(try decoded.evaluate([-1, 2, 3]) == false)
227+
}
228+
216229
@Test func disallowedKeyPath() throws {
217230
var predicate = #Predicate<Object> {
218231
$0.f

0 commit comments

Comments
 (0)