Skip to content

Instantly share code, notes, and snippets.

@lancepantz
Created July 23, 2010 05:42
Show Gist options
  • Save lancepantz/487069 to your computer and use it in GitHub Desktop.
Save lancepantz/487069 to your computer and use it in GitHub Desktop.
(defmacro project-let [bindings & body]
`(binding [project {:name "project-stub", :version "0.0.0", :root "/home/project"}]
(let ~bindings
~@body)))
(deftest file-fn
(testing "single string"
(project-let [s "foo/bar/baz"]
(is (= (str (:root project) "/" s)
(.toString (file s))))))
(testing "multiple strings"
(project-let [a "foo", b "bar"]
(is (= (str "/" a "/" b)
(.toString (file a b))))))
(testing "single file"
(project-let [s "foo", f (java.io.File. s)]
(is (= (str "/" s)
(.toString (file f))))))
(testing "file and string")
(testing "tilde expansion")
(testing "home directory"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment