arkitect icon indicating copy to clipboard operation
arkitect copied to clipboard

Permits to reuse the same that() for multiple should()

Open fain182 opened this issue 1 month ago • 2 comments

This fixes issue #303 where reusing the result of that() for multiple should() calls would cause duplicate violations due to shared mutable state in the RuleBuilder.

The fix makes should() and andThat() clone the RuleBuilder before adding constraints/specs, ensuring each rule branch gets an isolated copy of the builder state.

Added RuleBuilder::__clone() to deep clone Specs and Constraints objects.

fain182 avatar Dec 14 '25 12:12 fain182