git @ Cat's Eye Technologies Robin / 913acc6
Fix up exception expectations in several test suites. --HG-- branch : no_improper_lists Cat's Eye Technologies 13 years ago
6 changed file(s) with 49 addition(s) and 64 deletion(s). Raw diff Collapse all Expand all
103103
104104 A particular version of a module might, naturally, not be available.
105105
106 (TODO: The particular error message produced here may differ. Falderal
107 needs a forigiving-error-message option.)
108
109106 | (robin (0 1) ((small (0 781))) #t)
110 ? module/small_0_781.robin: openFile: does not exist (No such file or directory)
107 ? could not locate module file
111108
112109 And a particular module might, naturally, not even be available.
113110
114111 | (robin (0 1) ((gzgptzgztxxky (1 0))) #t)
115 ? module/gzgptzgztxxky_1_0.robin: openFile: does not exist (No such file or directory)
112 ? could not locate module file
116113
117114 And a particular version of a module may rely on a particular version
118115 of the fundamental semantics, so some combinations may not make sense.
130127
131128 | (robin (0 1) ((core (0 1)))
132129 | (number? 3/5))
133 ? undefined identifier number?
130 ? uncaught exception: (unbound-identifier number?)
134131
135132 The `*` qualifier imports a module unqualified.
136133
140137
141138 | (robin (0 1) ((core (0 1) *))
142139 | (core:number? 3/5))
143 ? undefined identifier core:number?
140 ? uncaught exception: (unbound-identifier core:number?)
144141
145142 Intrinsic Data Types
146143 --------------------
9898
9999 | (robin (0 1) ((arith (0 1) *))
100100 | (div 10 0))
101 ? uncaught exception: (division-by-zero . 10)
101 ? uncaught exception: (division-by-zero 10)
102102
103103 ### `rem` ###
104104
128128
129129 | (robin (0 1) ((arith (0 1) *))
130130 | (rem 10 0))
131 ? uncaught exception: (division-by-zero . 10)
131 ? uncaught exception: (division-by-zero 10)
132132
133133 ### `>` ###
134134
9696
9797 | (robin (0 1) ((boolean (0 1) *))
9898 | (not #t #f))
99 ? uncaught exception: (illegal-arguments #f)
99 ? uncaught exception: (illegal-arguments (#f))
100100
101101 ### `xor` ###
102102
3838
3939 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
4040 | (myself 123))
41 ? uncaught exception: (illegal-arguments 123)
41 ? uncaught exception: (illegal-arguments (123))
4242
4343 ### `pid?` ###
4444
5858
5959 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
6060 | (pid?))
61 ? uncaught exception: (illegal-arguments)
61 ? uncaught exception: (illegal-arguments ())
6262
6363 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
6464 | (pid? 200 500))
65 ? uncaught exception: (illegal-arguments 200 500)
65 ? uncaught exception: (illegal-arguments (200 500))
6666
6767 ### `spawn!` ###
6868
8686
8787 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
8888 | (spawn!))
89 ? uncaught exception: (illegal-arguments)
89 ? uncaught exception: (illegal-arguments ())
9090
9191 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
9292 | (spawn! cheesecake))
93 ? uncaught exception: (illegal-arguments cheesecake)
93 ? uncaught exception: (illegal-arguments (cheesecake))
9494
9595 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
9696 | (spawn! (fun (x) 0) (fun (x) 1)))
97 ? uncaught exception: (illegal-arguments (fun (x) 0) (fun (x) 1))
97 ? uncaught exception: (illegal-arguments ((fun (x) 0) (fun (x) 1)))
9898
9999 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
100100 | (spawn! (fun (x) 0) (fun (x) 1)
101101 | (fun (x) 2) (fun (x) 3)))
102 ? uncaught exception: (illegal-arguments (fun (x) 0) (fun (x) 1) (fun (x) 2) (fun (x) 3))
102 ? uncaught exception: (illegal-arguments ((fun (x) 0) (fun (x) 1) (fun (x) 2) (fun (x) 3)))
103103
104104 The first argument to `spawn!` must be a symbol.
105105
106106 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
107107 | (spawn! #f (literal ok) 123))
108 ? uncaught exception: (illegal-arguments #f (literal ok) 123)
108 ? uncaught exception: (illegal-arguments (#f (literal ok) 123))
109109
110110 ### `send!` ###
111111
123123
124124 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
125125 | (send! (literal eggs) (literal spam) (literal ok)))
126 ? uncaught exception: (expected-pid . eggs)
126 ? uncaught exception: (expected-pid eggs)
127127
128128 `send!` expects exactly three arguments.
129129
130130 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
131131 | (spawn! worker (literal ok)
132132 | (send! worker worker)))
133 ? uncaught exception: (illegal-arguments worker worker)
133 ? uncaught exception: (illegal-arguments (worker worker))
134134
135135 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
136136 | (spawn! worker (literal ok)
137137 | (send! worker worker worker worker)))
138 ? uncaught exception: (illegal-arguments worker worker worker worker)
138 ? uncaught exception: (illegal-arguments (worker worker worker worker))
139139
140140 ### `recv!` ###
141141
158158 | (bind parent (myself)
159159 | (spawn! worker (send! parent (literal lettuce) (literal ok))
160160 | (recv! (pair 7 ()) 9))))
161 ? uncaught exception: (illegal-arguments (pair 7 ()) 9)
161 ? uncaught exception: (illegal-arguments ((pair 7 ()) 9))
162162
163163 `recv!` expects exactly two arguments.
164164
166166 | (bind parent (myself)
167167 | (spawn! worker (send! parent (literal lettuce) (literal ok))
168168 | (recv! message))))
169 ? uncaught exception: (illegal-arguments message)
169 ? uncaught exception: (illegal-arguments (message))
170170
171171 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
172172 | (bind parent (myself)
173173 | (spawn! worker (send! parent (literal lettuce) (literal ok))
174174 | (recv! message message message))))
175 ? uncaught exception: (illegal-arguments message message message)
175 ? uncaught exception: (illegal-arguments (message message message))
176176
177177 Tests for both `send!` and `recv!` follow.
178178
267267
268268 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
269269 | (msgs? #t))
270 ? uncaught exception: (illegal-arguments #t)
270 ? uncaught exception: (illegal-arguments (#t))
271271
272272 ### `call!` ###
273273
284284 | (pair (pair tag (pair (literal reply) ()))
285285 | (pair (pair tag (pair payload ())) ()))) 0)))
286286 | (call! worker this-tag (literal this-payload) reply
287 | (pair (literal reply-was) reply))))
288 = (reply-was this-tag this-payload)
287 | (pair (literal reply-was) (pair reply ())))))
288 = (reply-was (this-tag this-payload))
289289
290290 The pid and tag in the return message must match, or `call!` will
291291 not finish. Note: this is an awful test, because an implementation
301301 | (pair (pair tag (pair (literal reply) ()))
302302 | (pair (pair tag (pair payload ())) ()))) 0)))
303303 | (call! worker this-tag (literal this-payload) reply
304 | (pair (literal reply-was) reply)))))
304 | (pair (literal reply-was) (pair reply ()))))))
305305 ? thread blocked indefinitely in an MVar operation
306306
307307 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
314314 | (pair (pair (literal some-other-tag) (literal reply))
315315 | (pair (pair tag payload) ()))) 0)))
316316 | (call! worker this-tag (literal this-payload) reply
317 | (pair (literal reply-was) reply)))))
317 | (pair (literal reply-was) (pair reply ()))))))
318318 ? thread blocked indefinitely in an MVar operation
319319
320320 If `call!` receives an exception message, it will `raise` that
325325 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
326326 | (spawn! worker
327327 | (recv! message
328 | (let ((send!er (head message))
328 | (let ((sender (head message))
329329 | (tag (head (tail message)))
330330 | (payload (head (tail (tail message)))))
331331 | (head (literal argh))))
332332 | (call! worker this-tag (literal this-payload) reply
333333 | (pair (literal reply-was) reply))))
334 ? uncaught exception: (expected-pair . argh)
334 ? uncaught exception: (expected-list argh)
335335
336336 `call!` expects its first argument to be a pid.
337337
338338 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
339339 | (call! (literal worker) this-tag (literal this-payload) reply
340340 | (pair (literal reply-was) reply)))
341 ? uncaught exception: (expected-pid . worker)
341 ? uncaught exception: (expected-pid worker)
342342
343343 `call!` expects its second argument to be a symbol.
344344
345345 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
346346 | (call! (myself) #f (literal this-payload) reply
347347 | (pair (literal reply-was) reply)))
348 ? uncaught exception: (illegal-arguments (myself) #f (literal this-payload) reply (pair (literal reply-was) reply))
348 ? uncaught exception: (illegal-arguments ((myself) #f (literal this-payload) reply (pair (literal reply-was) reply)))
349349
350350 `call!` expects its fourth argument to be an identifier.
351351
352352 | (robin (0 1) ((small (0 1) *) (concurrency (0 1) *))
353353 | (call! (myself) this-tag (literal this-payload) #f
354354 | (pair (literal reply-was) reply)))
355 ? uncaught exception: (illegal-arguments (myself) this-tag (literal this-payload) #f (pair (literal reply-was) reply))
355 ? uncaught exception: (illegal-arguments ((myself) this-tag (literal this-payload) #f (pair (literal reply-was) reply)))
356356
357357 ### `respond!` ###
358358
5656
5757 | (robin (0 1) ((pure (0 1) *) (exception (0 1) *))
5858 | (catch #f 23 (head #f)))
59 ? uncaught exception: (illegal-arguments #f 23 (head #f))
59 ? uncaught exception: (illegal-arguments (#f 23 (head #f)))
6060
6161 `catch` expects exactly three arguments.
6262
6363 | (robin (0 1) ((pure (0 1) *) (exception (0 1) *))
6464 | (catch error error))
65 ? uncaught exception: (illegal-arguments error error)
65 ? uncaught exception: (illegal-arguments (error error))
6666
6767 | (robin (0 1) ((pure (0 1) *) (exception (0 1) *))
6868 | (catch error error (head #f) 23))
69 ? uncaught exception: (illegal-arguments error error (head #f) 23)
69 ? uncaught exception: (illegal-arguments (error error (head #f) 23))
7070
7171 ### Re-exported Functions ###
7272
229229
230230 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
231231 | (index 7 (literal (the girl from ipanema))))
232 ? uncaught exception: (expected-list)
232 ? uncaught exception: (expected-list ())
233233
234234 `index` expects its first argument to be a number.
235235
241241
242242 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
243243 | (index 8 (literal whatnot)))
244 ? uncaught exception: (expected-pair whatnot)
244 ? uncaught exception: (expected-list whatnot)
245245
246246 ### `take-while` ###
247247
294294
295295 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
296296 | (drop-while (fun (x) (symbol? x)) #f))
297 ? uncaught exception: (expected-pair . #f)
297 ? uncaught exception: (expected-list #f)
298298
299299 ### `first` ###
300300
312312
313313 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
314314 | (first 6 (list 1 2 3 4 5)))
315 ? uncaught exception: (expected-pair)
316
317 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
318 | (first 6 (list 1 2 3 4 5 . 6)))
319 ? uncaught exception: (expected-pair . 6)
315 ? uncaught exception: (expected-list ())
320316
321317 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
322318 | (first 1 (literal foo)))
323 ? uncaught exception: (expected-pair . foo)
319 ? uncaught exception: (expected-list foo)
324320
325321 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
326322 | (first 0 (literal foo)))
347343
348344 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
349345 | (rest 6 (list 1 2 3 4 5)))
350 ? uncaught exception: (expected-pair)
351
352 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
353 | (rest 6 (list 1 2 3 4 5 . 6)))
354 ? uncaught exception: (expected-pair . 6)
346 ? uncaught exception: (expected-list ())
355347
356348 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
357349 | (rest 1 (literal foo)))
358 ? uncaught exception: (expected-pair . foo)
350 ? uncaught exception: (expected-list foo)
359351
360352 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
361353 | (rest 0 (literal foo)))
382374
383375 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
384376 | (last 6 (list 1 2 3 4 5)))
385 ? uncaught exception: (expected-pair)
386
387 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
388 | (last 6 (list 1 2 3 4 5 . 6)))
389 ? uncaught exception: (expected-pair . 6)
377 ? uncaught exception: (expected-list ())
390378
391379 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
392380 | (last 1 (literal foo)))
393 ? uncaught exception: (expected-pair . foo)
381 ? uncaught exception: (expected-list foo)
394382
395383 Unlike `first`, `last` does care if it's not a list, even when the count
396384 is zero.
397385
398386 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
399387 | (last 0 (literal foo)))
400 ? uncaught exception: (expected-pair . foo)
388 ? uncaught exception: (expected-list foo)
401389
402390 ### `prefix?` ###
403391
533521
534522 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
535523 | (delete (literal q) 55))
536 ? uncaught exception: (expected-pair 55)
537
538 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
539 | (delete (literal q) (literal ((a . 7) 99 (q . 4)))))
540 ? uncaught exception: (expected-pair 99)
524 ? uncaught exception: (expected-list 55)
525
526 | (robin (0 1) ((small (0 1) *) (list (0 1) *))
527 | (delete (literal q) (literal ((a 7) 99 (q 4)))))
528 ? uncaught exception: (expected-list 99)