aboutsummaryrefslogtreecommitdiff
path: root/tests/entity-test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/entity-test.scm')
-rw-r--r--tests/entity-test.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/entity-test.scm b/tests/entity-test.scm
index 5df8e76..988d1c9 100644
--- a/tests/entity-test.scm
+++ b/tests/entity-test.scm
@@ -113,4 +113,23 @@
(test-equal "right dvx" 2 (car (cdr (assq 'right imap))))
(test-equal "right dvy" 0 (cdr (cdr (assq 'right imap))))))
+(test-group "entity-skips-pipeline?"
+ (test-assert "absent skip list"
+ (not (entity-skips-pipeline? '(#:type a) 'gravity)))
+ (test-assert "empty skip list"
+ (not (entity-skips-pipeline? '(#:skip-pipelines ()) 'gravity)))
+ (test-assert "member"
+ (entity-skips-pipeline? '(#:skip-pipelines (gravity velocity-x)) 'gravity))
+ (test-assert "not member"
+ (not (entity-skips-pipeline? '(#:skip-pipelines (gravity)) 'velocity-x))))
+
+(define-pipeline (fixture-pipeline fixture-skip) (ent)
+ (entity-set ent #:x 42))
+
+(test-group "define-pipeline"
+ (let ((e '(#:type t #:x 0)))
+ (test-equal "runs body" 42 (entity-ref (fixture-pipeline e) #:x)))
+ (let ((e '(#:type t #:x 0 #:skip-pipelines (fixture-skip))))
+ (test-equal "skipped" 0 (entity-ref (fixture-pipeline e) #:x))))
+
(test-end "entity")