syndicate-2017/racket/typed/tests/spawn.rkt

36 lines
957 B
Racket
Raw Normal View History

#lang typed/syndicate
2020-02-25 21:14:30 +00:00
(require rackunit/turnstile)
(check-type
(spawn (U (Tuple Int) (Observe (Tuple ★/t)))
(start-facet _
(on (asserted (tuple $x))
(add1 x))))
;; wanted: ν-s ((Actor (Tuple Int)))
: ★/t)
(typecheck-fail
(spawn (U (Tuple String) (Observe (Tuple ★/t)))
(start-facet _
(on (asserted (tuple $x:Int))
(add1 x))))
2020-10-16 14:34:53 +00:00
#:with-msg "spawn: Not prepared to handle inputs:\n\\(Tuple String\\)")
2020-02-25 21:14:30 +00:00
(check-type
(spawn (U)
(start-facet _
(know (tuple 5))
(on (know (tuple $x:Int))
(add1 x))))
;; wanted: ν-s ((Actor (U)))
: ★/t)
(typecheck-fail
(spawn (U)
(start-facet _
(know (tuple "hi"))
(on (know (tuple $x:Int))
(add1 x))))
2020-10-16 14:34:53 +00:00
#:with-msg "spawn: Not prepared to handle internal events:\n\\(Tuple String\\)")