Minilisp.pm/t/context.t
2021-04-09 00:01:27 +02:00

14 lines
298 B
Perl

(plan 3)
(let ((a 2))
(let ((a 10))
(expect "Inner variable shadows outer" (= a 10)))
(expect "Outer is not overriden" (= a 2)))
(let ((pings 0))
(defun ping ()
(set pings (+ pings 1)))
(ping) (ping) (ping)
(expect "setting variables in outside context works" (= pings 3)))