2021-06-04 13:56:03 +00:00
|
|
|
;;; SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
2021-06-01 15:19:24 +00:00
|
|
|
|
2020-04-27 18:27:48 +00:00
|
|
|
#lang syndicate/test-implementation
|
2018-04-29 10:55:32 +00:00
|
|
|
;; Tests that pending actions are abandoned during a turn in which there is an exception
|
|
|
|
|
|
|
|
(test-case
|
|
|
|
[(message-struct stage (n))
|
|
|
|
|
|
|
|
(spawn #:name 'actor0
|
|
|
|
(on (message (stage 0))
|
|
|
|
(send! (stage 1)))
|
|
|
|
|
|
|
|
(on (message (stage 2))
|
|
|
|
(send! (stage 3))
|
|
|
|
(error 'test-case "Deliberate error")
|
|
|
|
(send! (stage 3))))
|
|
|
|
|
|
|
|
(spawn #:name 'main
|
|
|
|
(on (message (stage $v))
|
|
|
|
(printf "Got message ~v\n" v))
|
|
|
|
(on-start
|
|
|
|
(until (asserted (observe (stage 0))))
|
|
|
|
(send! (stage 0))
|
|
|
|
(until (message (stage 1)))
|
|
|
|
(send! (stage 2))))]
|
|
|
|
(it "should involve one crash" (actor-died? 'actor0 "Deliberate error"))
|
2018-05-06 09:55:02 +00:00
|
|
|
(expected-output (list "Got message 0"
|
|
|
|
"Got message 1"
|
|
|
|
"Got message 2")))
|