From 9e8b75f9949259ef01942cd3717b79b044efddf7 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Wed, 8 Apr 2026 01:57:20 +0100 Subject: Refactor update pipelines --- tests/entity-test.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/entity-test.scm') diff --git a/tests/entity-test.scm b/tests/entity-test.scm index 988d1c9..795aa1c 100644 --- a/tests/entity-test.scm +++ b/tests/entity-test.scm @@ -132,4 +132,19 @@ (let ((e '(#:type t #:x 0 #:skip-pipelines (fixture-skip)))) (test-equal "skipped" 0 (entity-ref (fixture-pipeline e) #:x)))) +(define-pipeline (guarded-pipeline guarded-skip) (ent) + guard: (entity-ref ent #:active? #f) + (entity-set ent #:x 99)) + +(test-group "define-pipeline with guard:" + (let ((e '(#:type t #:x 0 #:active? #t))) + (test-equal "runs body when guard passes" 99 + (entity-ref (guarded-pipeline e) #:x))) + (let ((e '(#:type t #:x 0))) + (test-equal "returns entity unchanged when guard fails" 0 + (entity-ref (guarded-pipeline e) #:x))) + (let ((e '(#:type t #:x 0 #:active? #t #:skip-pipelines (guarded-skip)))) + (test-equal "skip-pipelines takes precedence over guard" 0 + (entity-ref (guarded-pipeline e) #:x)))) + (test-end "entity") -- cgit v1.2.3