test(validation): cover the Bool forms of the && and || combinators

The error-array forms of && and || were unit-tested; the Bool predicate
forms were not. Add a pure-function test so every combinator overload in
the algebra is exercised, completing the framework's combinator coverage.
This commit is contained in:
Mihaela Mihaljevic 2026-06-09 09:07:43 +02:00
parent 16ee379abc
commit b42ee11e3a
2 changed files with 11 additions and 1 deletions

View File

@ -88,7 +88,7 @@ flowchart TB
PureXML is a working, dependency-free XML library today: parse, emit, validate,
query, and stream documents on macOS, Linux, Windows, and WASM. The test suite
currently runs **767 tests in 117 suites** (`swift test`).
currently runs **768 tests in 117 suites** (`swift test`).
### Shipped (libxml2-aligned surface)

View File

@ -63,6 +63,16 @@ struct ValidationFrameworkTests {
#expect((fail || fail)(context(sample)).count == 2)
}
@Test("The Bool forms of && and || combine predicates")
func test_andOrBool() {
let yes: (Context) -> Bool = { _ in true }
let nope: (Context) -> Bool = { _ in false }
#expect((yes && yes)(context(sample)))
#expect(!(yes && nope)(context(sample)))
#expect((yes || nope)(context(sample)))
#expect(!(nope || nope)(context(sample)))
}
@Test("take digs to a value and runs logic")
func test_take() {
let check: (Context) -> Bool = take(\Element.attributes) { $0.count == 1 }