35 lines
1.5 KiB
Racket
35 lines
1.5 KiB
Racket
;;; SPDX-License-Identifier: LGPL-3.0-or-later
|
|
;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
|
|
|
#lang syndicate/test-implementation
|
|
;; An error signalled during setup of a new actor's root facet must
|
|
;; cause previous actions to be discarded, but must also cause any
|
|
;; initial-assertions, including specifically linkage assertions from
|
|
;; during/spawn, to be briefly visible.
|
|
|
|
(test-case
|
|
[(assertion-struct request (id))
|
|
(assertion-struct response (value))
|
|
|
|
(spawn (during/spawn (request $id)
|
|
(printf "starting request handler\n")
|
|
(assert (response 'the-answer)) ;; must not be visible
|
|
(printf "asserted response, shouldn't be visible\n")
|
|
(error 'aieee "oh no")
|
|
(printf "NOTREACHED\n")))
|
|
|
|
(spawn (stop-when (asserted (observe (request _)))
|
|
(printf "service listening\n")
|
|
(react
|
|
(assert (request 101))
|
|
(stop-when (retracted (observe (request _)))
|
|
(printf "whole service vanished\n"))
|
|
(stop-when (retracted (observe (request 101)))
|
|
(printf "specific instance vanished\n"))
|
|
(stop-when (asserted (response $v))
|
|
(printf "response ~v\n" v)))))]
|
|
(expected-output (list "service listening"
|
|
"starting request handler"
|
|
"asserted response, shouldn't be visible"
|
|
"specific instance vanished")))
|