#lang imperative-syndicate/test-implementation
;; See .../syndicate/examples/actor/example-during-criterion-shapshotting.rkt

(test-case
    [(struct foo (x y) #:prefab)
     (spawn (field [x 123])
            (assert (foo (x) 999))
            (during (foo (x) $v)
              (define x0 (x))
              (printf "x=~a v=~a\n" (x) v)
              (when (= (x) 123) (x 124))
              (on-stop
               (printf "finally for x0=~a x=~a v=~a\n" x0 (x) v))))]
  no-crashes
  (expected-output (list "x=123 v=999"
                         "x=124 v=999"
                         "finally for x0=123 x=124 v=999")))
