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:
parent
16ee379abc
commit
b42ee11e3a
@ -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)
|
||||
|
||||
|
||||
@ -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 }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user