Browse Source

Add test for keyword argumnets over CapTP

fix-gitlab-ci
Jessica Tallon 3 years ago
parent
commit
420fd86869
  1. 22
      goblins/ocapn/captp-test.rkt

22
goblins/ocapn/captp-test.rkt

@ -563,3 +563,25 @@
#;(collect-garbage)
;; ... damn we actually need to test the messages sent at some point
;; Test keyword argument sending in CapTP
(define ((^kw-car-factory _bcom brand) model #:color color #:noise noise)
(define (^car _bcom brand color noise)
(format "a ~a ~a ~a goes ~a!" color brand model noise))
(spawn ^car brand model color noise))
(define result-ch (make-async-channel))
(define fork-factory (a-run (spawn ^kw-car-factory "fork")))
(define fork-factory-sref (m1-run ($ m1-mycapn 'register fork-factory 'fake)))
(let* ((fork-factory-vow (m2-run (<- m2-mycapn 'enliven fork-factory-sref)))
(red-explorer-vow (<- fork-factory-vow "explorer" #:color "red" "vroooom")))
(b-run
(on (<- red-explorer-vow)
(lambda (car-noise)
(async-channel-put result-ch `(ok ,car-noise))))))
(test-equal?
"Sending keyword arguments over CapTP works"
(sync/timeout 0.5 result-ch)
'(ok "a red fork explorer goes vroooom! beep"))

Loading…
Cancel
Save