Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

TESTS: Updated tests for new send/recv API

  • Loading branch information...
commit a89a1ee102196a95a2a95a35d3ae736d3868d48a 1 parent b88b8c5
Josh Marchán authored

Showing 1 changed file with 14 additions and 14 deletions. Show diff stats Hide diff stats

  1. +14 14 tests/channels.lisp
28 tests/channels.lisp
@@ -49,27 +49,27 @@
49 49
50 50 (test send-unbuffered
51 51 (let ((channel (make-instance 'channel)))
52   - (is (null (send channel 'test nil)))
  52 + (is (null (send channel 'test :blockp nil)))
53 53 (pexec () (recv channel))
54 54 (is (eq channel (send channel 'test)))
55 55 (pexec () (recv channel))
56 56 (is (eq channel (send channel 'test)))
57 57 (pexec () (recv channel))
58 58 (sleep 0.5) ;hax to let the thread start working
59   - (is (eq channel (send channel 'test nil)))))
  59 + (is (eq channel (send channel 'test :blockp nil)))))
60 60
61 61 (test send-buffered
62 62 (let ((channel (make-instance 'bounded-channel :size 1)))
63   - (is (eq channel (send channel 'test nil)))
  63 + (is (eq channel (send channel 'test :blockp nil)))
64 64 (recv channel)
65 65 (is (eq channel (send channel 'test)))
66   - (is (null (send channel 'test nil)))
  66 + (is (null (send channel 'test :blockp nil)))
67 67 (pexec () (recv channel))
68 68 (is (eq channel (send channel 'test)))))
69 69
70 70 (test send-sequence
71 71 (let ((channels (loop repeat 3 collect (make-instance 'channel))))
72   - (is (null (send channels 'test nil)))
  72 + (is (null (send channels 'test :blockp nil)))
73 73 (pexec () (recv (elt channels 1)))
74 74 (is (eq (elt channels 1) (send channels 'test)))))
75 75
@@ -78,8 +78,8 @@
78 78
79 79 (test recv-unbuffered
80 80 (let ((channel (make-instance 'channel)))
81   - (is (null (nth-value 1 (recv channel nil))))
82   - (is (null (values (recv channel nil))))
  81 + (is (null (nth-value 1 (recv channel :blockp nil))))
  82 + (is (null (values (recv channel :blockp nil))))
83 83 (pexec () (send channel 'test))
84 84 (multiple-value-bind (value rec-chan)
85 85 (recv channel)
@@ -93,26 +93,26 @@
93 93 (is (eq 'test value)))
94 94 (pexec () (send channel 'test))
95 95 (sleep 0.5)
96   - (is (eq 'test (recv channel nil)))))
  96 + (is (eq 'test (recv channel :blockp nil)))))
97 97
98 98 (test recv-buffered
99 99 (let ((channel (make-instance 'bounded-channel :size 1)))
100   - (is (null (recv channel nil)))
101   - (is (null (nth-value 1 (recv channel nil))))
  100 + (is (null (recv channel :blockp nil)))
  101 + (is (null (nth-value 1 (recv channel :blockp nil))))
102 102 (send channel 'test)
103 103 (multiple-value-bind (value rec-chan)
104 104 (recv channel)
105 105 (is (eq channel rec-chan))
106 106 (is (eq 'test value)))
107   - (is (null (recv channel nil)))
108   - (is (null (nth-value 1 (recv channel nil))))
  107 + (is (null (recv channel :blockp nil)))
  108 + (is (null (nth-value 1 (recv channel :blockp nil))))
109 109 (pexec () (send channel 'test))
110 110 (is (eq 'test (recv channel)))))
111 111
112 112 (test recv-sequence
113 113 (let ((channels (loop repeat 3 collect (make-instance 'channel))))
114   - (is (null (recv channels nil)))
115   - (is (null (nth-value 1 (recv channels nil))))
  114 + (is (null (recv channels :blockp nil)))
  115 + (is (null (nth-value 1 (recv channels :blockp nil))))
116 116 (pexec () (send (elt channels 1) 'test))
117 117 (multiple-value-bind (value rec-chan)
118 118 (recv channels)

0 comments on commit a89a1ee

Please sign in to comment.
Something went wrong with that request. Please try again.