diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-04-08 01:57:20 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-04-08 01:57:20 +0100 |
| commit | 9e8b75f9949259ef01942cd3717b79b044efddf7 (patch) | |
| tree | c6b71291ade57f0560a9bbf0db9f5b66bab65cb3 /tests/entity-test.scm | |
| parent | 84840ede6646ed793b61cdd889d3f57ab05e9311 (diff) | |
Refactor update pipelines
Diffstat (limited to 'tests/entity-test.scm')
| -rw-r--r-- | tests/entity-test.scm | 15 |
1 files changed, 15 insertions, 0 deletions
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") |
