Permalink
Browse files

Adding an integration test for namespace replacement.

  • Loading branch information...
1 parent b186394 commit 43a7270920bb0ba4cf78401cf68cda05c200acc7 @tcrayford tcrayford committed Aug 26, 2010
@@ -14,7 +14,7 @@
"Builds a replacement map for emacs for a given namespace"
{:file (filename-from-ns ns)
:new-source (parsley-to-string
- (f (:parsley (parsley-from-cache ns))))})
+ (map f (parsley-from-cache ns)))})
(defn replace-namespaces [namespaces f]
"Replaces vars by calling f on each one."
@@ -84,7 +84,7 @@
(new-ns-entry namespace-name)))
(defn parsley-from-cache [namespace-name]
- (:parsley entry-from-ns-cache))
+ (:parsley (entry-from-ns-cache namespace-name)))
(defn add-to-ns-cache! [ns]
(swap! ns-cache assoc (force-ns-name ns) (new-ns-entry ns)))
@@ -3,6 +3,7 @@
(:use [clojure-refactoring.support source parsley
paths])
(:use clojure.test)
+ (:use clojure-refactoring.test-helpers)
(:use clojure.contrib.mock))
(use-fixtures :once #(time (%)))
@@ -40,3 +41,11 @@
map-to-alist (times 1 (returns :replacement-alist))
build-replacement-map (times 1 (returns :replacement-map))]
(is (= (replace-callers 'a replace-test-fn) [:replacement-alist]))))
+
+(deftest replace_namespaces
+ (doseq [namespace (find-ns-in-user-dir)]
+ (let [source (slurp (filename-from-ns namespace))]
+ (is (= source
+ (:new-source (build-replacement-map namespace identity)))))))
+
+

0 comments on commit 43a7270

Please sign in to comment.