ClojureGiven icon indicating copy to clipboard operation
ClojureGiven copied to clipboard

Unable to resolve local names in When and Then

Open imrekoszo opened this issue 10 years ago • 0 comments

Hi,

Something seems to be broke in When and Then around resolving names. Please see the example below.

(ns cljgiven.test.core
  (:use [cljgiven.core])
  (:use [clojure.test]))

(defn bar [v]
  (inc v))

;; Fails with "Unable to resolve symbol: bar in this context"
(defspec
  name-resolving-fails-in-when
  (Given [foo 1])
  (When result (bar foo))
  (Then (= 2 result)))

;; Fails with "Unable to resolve symbol: bar in this context"
(defspec
  name-resolving-fails-in-then
  (Given [foo 1])
  (Then (= 2 (bar foo))))

;; Passes when names are fully specified
(defspec
  name-resolving-works-when-fully-specified
  (Given [foo 1])
  (When result (cljgiven.test.core/bar foo))
  (Then (= 2 result))
  (Then (= 2 (cljgiven.test.core/bar foo))))

imrekoszo avatar Nov 18 '15 12:11 imrekoszo