Created
April 14, 2018 08:46
-
-
Save wavejumper/a9d058b39a228bbf67de2fd96b9f94ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns static.core-test | |
(:require [clojure.test :refer :all] | |
[static.core :as s])) | |
(defmacro with-env [eval-sym & body] | |
`(let [env# (s/create-env) | |
~eval-sym (partial s/-eval env#)] | |
~@body)) | |
(deftest scoping | |
(with-env eval | |
(testing "Let binding closing over fn" | |
(eval | |
'(let [x (fn [y] y)] | |
(defn foo "foo" {:a :b} [a b c] {:pre (+ 1 2) :post (+ 1 2)} | |
(if true "a" (+ 1 2)) | |
;;(+ 1 2 3) | |
(let [a (if true 1 :a)] | |
(x b))))) | |
(let [resp (eval '(foo 1 2 3))] | |
(is (= 2 (-> resp :output :output :value))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment