Skip to content

Instantly share code, notes, and snippets.

@Beyamor
Created December 14, 2012 06:56
Show Gist options
  • Save Beyamor/4283264 to your computer and use it in GitHub Desktop.
Save Beyamor/4283264 to your computer and use it in GitHub Desktop.
Argument inferencer tests.
(ns infer-arg.test.core
(:use [infer-arg.core])
(:use [clojure.test]))
(deftest fn-without-arg-list-not-wrapped
(is (= 2 ((inference-wrapper (fn [x] (inc x))) 1))))
(deftest fn-with-arg-list-is-wrapped
(is (= 2
((inference-wrapper
(with-meta
(fn [x] (inc x))
{:arg-list [:x]}))
{:x 1}))))
(deftest fn-with-arg-list-adds-arg-list
(is (= 2
((inference-wrapper
(fn|arg-list
[x] (inc x)))
{:x 1}))))
(defn|arg-list
test-fn [x] (inc x))
(deftest defn-with-arg-list-adds-arg-list
(is (= 2
((inference-wrapper test-fn) {:x 1}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment