21 lines
778 B
Racket
21 lines
778 B
Racket
|
#lang imperative-syndicate/test-implementation
|
||
|
;; An error signalled mid-turn must cause previous actions to be
|
||
|
;; discarded; discarded actions must not be observed by peers.
|
||
|
|
||
|
(test-case
|
||
|
[(message-struct set-box (new-value))
|
||
|
(assertion-struct box-state (value))
|
||
|
|
||
|
(spawn (field [current-value 0])
|
||
|
(assert (box-state (current-value)))
|
||
|
(on (message (set-box $new-value)) (current-value new-value))
|
||
|
(begin/dataflow (when (= (current-value) 3)
|
||
|
(error 'box "aiee"))))
|
||
|
|
||
|
(spawn (on (asserted (box-state $v)) ;; must not see 3 here.
|
||
|
(printf "~v\n" v)
|
||
|
(send! (set-box (+ v 1)))))]
|
||
|
(expected-output (list "0"
|
||
|
"1"
|
||
|
"2")))
|