v1.1.0: pooled runtime, 959 tests, production hardening (0 squash)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Quantifier combinators for compositional expectations
|
||||
// all(), any(), none() wrap multiple assertions into quantified groups.
|
||||
|
||||
import type { FluentAssertion, FluentRelation } from './fluent.js'
|
||||
|
||||
export type ComposableAssertion = FluentAssertion | FluentRelation
|
||||
|
||||
export interface QuantifiedGroup {
|
||||
kind: 'all' | 'any' | 'none'
|
||||
assertions: ComposableAssertion[]
|
||||
}
|
||||
|
||||
/** Every assertion in the group must hold. */
|
||||
export function all(...assertions: ComposableAssertion[]): QuantifiedGroup {
|
||||
return { kind: 'all', assertions }
|
||||
}
|
||||
|
||||
/** At least one assertion in the group must hold. */
|
||||
export function any(...assertions: ComposableAssertion[]): QuantifiedGroup {
|
||||
return { kind: 'any', assertions }
|
||||
}
|
||||
|
||||
/** No assertion in the group may hold. */
|
||||
export function none(...assertions: ComposableAssertion[]): QuantifiedGroup {
|
||||
return { kind: 'none', assertions }
|
||||
}
|
||||
Reference in New Issue
Block a user