9 (message "Smooth sailing"))
11 (defun erl-message-test ()
12 "Some message send/receive checks."
15 (erl-spawn-async (push 1 v
))
16 (erl-spawn (push 2 v
))
18 (erl-send erl-self
'x
) ; make ourselves schedulable
19 (erl-continue (lambda () (push 4 v
))))
20 (unless (equal (sort v
#'<) '(1 2 3 4))
21 (error "Error, v = %S" v
))))
23 (make-local-variable 'erl-test-thingo
)
25 (defun erl-exit-test ()
26 "Check that exits propagate along links."
29 (setq erl-test-thingo
'a
)
30 (setq c
(erl-spawn (erl-continue 'nofun
)))
32 (setq d
(erl-spawn-link (setq erl-test-thingo
'd
)
33 (setq erl-trap-exit t
)
34 (erl-continue-forever)))
35 (setq b
(erl-spawn-link-async (setq erl-test-thingo
'b
)
37 (erl-continue-forever)))
38 (assert (not (erl-local-pid-alive-p a
)))
39 (assert (not (erl-local-pid-alive-p b
)))
40 (assert (not (erl-local-pid-alive-p c
)))
41 (assert (erl-local-pid-alive-p d
))
43 (assert (equal (pop erl-mailbox
)
44 (tuple 'EXIT a
'stop
))))
47 (defun erl-binding-capture-test ()
53 (setq bs
(capture-bindings x y z
))
54 (equal '(1 foo
(error "z"))
59 (defun erl-continue-forever ()
60 (erl-continue #'erl-continue-forever
))
62 (defun erl-spawn-tag-srv (tag)
64 (erl-register 'tag-srv
)
65 (erl-tag-srv-loop tag
)))
67 (defun erl-tag-srv-loop (tag)
70 (message "Tagged: %S" msg
))
72 (message "Other: %S %S" other msg
)))
73 (erl-tag-srv-loop tag
)))
75 ;; Interactive testing for high level features
77 (defvar erl-interactive-test-cases
78 (list (lambda (node) (erl-process-list node
))
80 (find-file "/home/luke/devel/erlang/foo.erl")
82 (erlang-extended-mode t
)
83 (message "DebugMe"))))
85 (defvar erl-interactive-remaining-cases
86 erl-interactive-test-cases
)
88 (defun erl-interactive-next-test (node)
89 (interactive (list (erl-target-node)))
90 (when current-prefix-arg
91 (setq erl-interactive-remaining-cases erl-interactive-test-cases
))
92 (funcall (pop erl-interactive-remaining-cases
) node
))