add new loop tests (based on sicl loop defects)
This is a short session I've run on IRC when poking SICL loop that revealed a few defects not included in tests. The first result is incorrect, the second result is correct:
-
check whether suitable default value of typed variable is supplied
CL-USER> (sicl-loop:loop with x of-type (unsigned-byte 8) do (print x)
until t
finally (print `(ha ,x)))
NIL
(HA NIL)
NIL
CL-USER> (loop with x of-type (unsigned-byte 8) do (print x)
until t
finally (print `(ha ,x)))
0
(HA 0)
NIL
-
check whether the step is executed at the end of each iteration of ON clause
CL-USER> (sicl-loop:loop for x on '(1 2 3)
initially (print `(x ,x))
do (print x)
finally (print `(ha ,x)))
(X (1 2 3))
(1 2 3)
(2 3)
(3)
(HA (3))
NIL
CL-USER> (loop for x on '(1 2 3)
initially (print `(x ,x))
do (print x)
finally (print `(ha ,x)))
(X (1 2 3))
(1 2 3)
(2 3)
(3)
(HA NIL)
NIL
-
check whether the variable is set at the beginning of each iteration (i.e after the prologue code) [in operator]
CL-USER> (sicl-loop:loop for x in '(1 2 3)
initially (print `(x ,x))
do (print x)
finally (print `(ha ,x)))
(X 1)
1
2
3
(HA 3)
NIL
CL-USER> (loop for x in '(1 2 3)
initially (print `(x ,x))
do (print x)
finally (print `(ha ,x)))
(X NIL)
1
2
3
(HA 3)
NIL
Edited by Daniel Kochmański