From b42ee11e3a37f7d619d007e5531194ccefedccb5 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Tue, 9 Jun 2026 09:07:43 +0200 Subject: [PATCH] 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. --- README.md | 2 +- Tests/ValidationFrameworkTests.swift | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35ccac4..3eddba2 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/Tests/ValidationFrameworkTests.swift b/Tests/ValidationFrameworkTests.swift index 56485d8..f164402 100644 --- a/Tests/ValidationFrameworkTests.swift +++ b/Tests/ValidationFrameworkTests.swift @@ -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 }