Commit ba12cb99 authored by Attila Lendvai's avatar Attila Lendvai
Browse files

Added 3 failing tests: always.finally, never.finally, and thereis.finally

Ignore-this: f3e9d3983567eb04ce2429b310bee837

I'm not sure about what is their contract, but it was surprising to me
that the FINALLY block is not executed.

Arguably if you're expected to avoid sideffects in a FINALLY block,
then you cannot/shouldn't change the return value, so the entire
FINALLY block can be skipped then.

Either way, this behavior should be documented with the tests, so
if the current behavior is expected, then change the tests
accordingly (as opposed to deleting them).

darcs-hash:c0b172b51bc40943946c86d8ab76297807d26594
parent f729d36c
......@@ -128,6 +128,31 @@
(iter (for i in '()) (always i))
t)
(deftest always.finally
(with-output-to-string (*standard-output*)
(iter (repeat 1)
;; When ALWAYS fails, it RETURN-FROM's from the block and
;; thus skips FINALLY.
(always nil)
(finally (princ 42))))
"42")
(deftest never.finally
(with-output-to-string (*standard-output*)
(iter (repeat 1)
;; See comment at ALWAYS.4
(never t)
(finally (princ 42))))
"42")
(deftest thereis.finally
(with-output-to-string (*standard-output*)
(iter (repeat 1)
;; See comment at ALWAYS.4
(thereis 43)
(finally (princ 42))))
"42")
(deftest always.never.1
(iterate (repeat 2)
(always 2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment