Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix formatting of tests.

  • Loading branch information...
commit 89d6aef77b5e87b64bcbbeb3ffdde9f0b487265c 1 parent 878a902
@technomancy authored
View
36 test/slam/hound/asplode_test.clj
@@ -1,7 +1,7 @@
(ns slam.hound.asplode-test
- (:require [clojure.test :refer [deftest is]]
- [slam.hound.asplode :refer [asplode]])
- (:import java.io.StringReader))
+ (:require [clojure.test :refer [deftest is]]
+ [slam.hound.asplode :refer [asplode]])
+ (:import (java.io StringReader)))
(deftest ^:unit test-asplode
@@ -16,21 +16,23 @@
[clojure.test :only [deftest]]]
:require '([clojure.java.io :as io] [clojure.set :as set])
:import '(java.io.File java.io.ByteArrayInputStream
- clojure.lang.Compiler$BodyExpr java.util.UUID)
+ clojure.lang.Compiler$BodyExpr
+ java.util.UUID)
:refer-clojure '(:exclude [compile test])
:gen-class nil}}
'((do something))]
- (asplode (StringReader. (str '(ns slamhound.sample
- "Testing some things going on here."
- (:use [slam.hound.stitch :only [ns-from-map]]
- [clojure.test :only [is]]
- [clojure.test :only [deftest]])
- (:require [clojure.java.io :as io]
- [clojure.set :as set])
- (:import java.io.File java.io.ByteArrayInputStream
- clojure.lang.Compiler$BodyExpr
- java.util.UUID)
- (:refer-clojure :exclude [compile test])
- (:gen-class))
- '(do something)))))))
+ (asplode (StringReader.
+ (str '(ns slamhound.sample
+ "Testing some things going on here."
+ (:use [slam.hound.stitch :only [ns-from-map]]
+ [clojure.test :only [is]]
+ [clojure.test :only [deftest]])
+ (:require [clojure.java.io :as io]
+ [clojure.set :as set])
+ (:import java.io.File java.io.ByteArrayInputStream
+ clojure.lang.Compiler$BodyExpr
+ java.util.UUID)
+ (:refer-clojure :exclude [compile test])
+ (:gen-class))
+ '(do something)))))))
View
38 test/slam/hound/regrow_test.clj
@@ -2,7 +2,6 @@
(:require [clojure.test :refer [deftest is testing]]
[slam.hound.regrow :refer [regrow in-originals-pred]]))
-
(def sample-body
'((set/union #{:a} #{:b})
(UUID/randomUUID)
@@ -13,22 +12,31 @@
(is (= (ns-from-map {:ns 'slam.hound}))))))
(deftest ^:unit test-regrow
- (testing "regrows the :require-as, :require-refer, and :import k/v pairs onto the ns-map"
+ (testing "regrows the :require-as, :require-refer, and :imports onto ns-map"
(is (= {:name 'slamhound.sample
:meta {:doc "Testing some things going on here."}
:refer-clojure '(:exclude [compile test])
:gen-class nil
- :require-as '([clojure.java.io :as io] [clojure.set :as set])
- :require-refer '([slam.hound.stitch :refer [ns-from-map]] [clojure.test :refer [is]] [clojure.test :refer [deftest]])
- :import '(java.io.File java.io.ByteArrayInputStream clojure.lang.Compiler$BodyExpr java.util.UUID)
+ :require-as '[[clojure.java.io :as io] [clojure.set :as set]]
+ :require-refer '[[slam.hound.stitch :refer [ns-from-map]]
+ [clojure.test :refer [is]]
+ [clojure.test :refer [deftest]]]
+ :import '(java.io.File java.io.ByteArrayInputStream
+ clojure.lang.Compiler$BodyExpr
+ java.util.UUID)
:old {:name 'slamhound.sample
:meta {:doc "Testing some things going on here."}
- :use '[[slam.hound.stitch :only [ns-from-map]] [clojure.test :only [is]] [clojure.test :only [deftest]]]
- :require '([clojure.java.io :as io] [clojure.set :as set])
- :import '(java.io.File java.io.ByteArrayInputStream clojure.lang.Compiler$BodyExpr java.util.UUID)
+ :use '[[slam.hound.stitch :only [ns-from-map]]
+ [clojure.test :only [is]]
+ [clojure.test :only [deftest]]]
+ :require '[[clojure.java.io :as io]
+ [clojure.set :as set]]
+ :import '[java.io.File java.io.ByteArrayInputStream
+ clojure.lang.Compiler$BodyExpr
+ java.util.UUID]
:refer-clojure '(:exclude [compile test])
:gen-class nil}}
-
+
(regrow [{:name 'slamhound.sample
:meta {:doc "Testing some things going on here."}
:refer-clojure '(:exclude [compile test])
@@ -38,16 +46,16 @@
:use '[[slam.hound.stitch :only [ns-from-map]]
[clojure.test :only [is]]
[clojure.test :only [deftest]]]
- :require '([clojure.java.io :as io] [clojure.set :as set])
- :import '(java.io.File java.io.ByteArrayInputStream
- clojure.lang.Compiler$BodyExpr java.util.UUID)
+ :require '[[clojure.java.io :as io]
+ [clojure.set :as set]]
+ :import '[java.io.File
+ java.io.ByteArrayInputStream
+ clojure.lang.Compiler$BodyExpr
+ java.util.UUID]
:refer-clojure '(:exclude [compile test])
:gen-class nil}}
sample-body])))))
-
-
-
(deftest ^:unit test-grow-preserve
(let [in-orig? (in-originals-pred ['((java.util Date UUID))])]
(is (in-orig? 'java.util.Date))
View
10 test/slam/hound/stitch_test.clj
@@ -1,6 +1,7 @@
(ns slam.hound.stitch-test
(:require [clojure.test :refer [deftest is]]
- [slam.hound.stitch :refer [ns-from-map stitch-up sort-subclauses collapse-clause]]))
+ [slam.hound.stitch :refer [ns-from-map stitch-up
+ sort-subclauses collapse-clause]]))
(def sample-ns-form '(ns slamhound.sample
"Testing some things going on here."
@@ -28,7 +29,8 @@
(deftest ^:unit test-ns-from-map
(is (= sample-ns-form (ns-from-map sample-ns-map))))
-;; TODO Dec 21st - is this test neccecary? It *should* be covered by tests for stitch-up
+;; TODO Dec 21st - is this test necessary?
+;; It *should* be covered by tests for stitch-up
(deftest ^:unit test-sort
(is (= {:name 'slamhound.sample
:meta {:doc "Testing some things going on here."}
@@ -54,7 +56,8 @@
(is (= {:require-refer '[[clojure.test :refer [deftest is]]
[slam.hound.stitch :refer [ns-from-map]]]}
(collapse-clause {:require-refer '[[clojure.test :refer [deftest]]
- [slam.hound.stitch :refer [ns-from-map]]
+ [slam.hound.stitch :refer
+ [ns-from-map]]
[clojure.test :refer [is]]]}
:require-refer))))
@@ -70,4 +73,3 @@
(java.util UUID))
(:refer-clojure :exclude [compile test]))
" (stitch-up sample-ns-map))))
-
View
47 test/slam/hound_test.clj
@@ -1,14 +1,14 @@
(ns slam.hound-test
(:require [clojure.test :refer [deftest is testing]]
[slam.hound :refer [reconstruct]])
- (:import java.io.StringReader))
-
+ (:import (java.io StringReader)))
(def basic-ns (str '(ns slamhound.sample
"Testing some things going on here."
(:use [slam.hound.stitch :only [ns-from-map]]
[clojure.test :only [is]]
- [clojure.test :only [deftest testing]]) ;; 'testing' isn't used, so gets dropped
+ ;; 'testing' isn't used, so gets dropped
+ [clojure.test :only [deftest testing]])
(:require [clojure.java.io :as io]
[clojure.set :as set])
(:import java.io.File java.io.ByteArrayInputStream
@@ -20,7 +20,7 @@
'(set/union #{:a} #{:b})
'(UUID/randomUUID)
'(instance? Compiler$BodyExpr nil)
- '(io/copy (ByteArrayInputStream. (.getBytes "remotely human"))
+ '(io/copy (ByteArrayInputStream. (.getBytes "remotely"))
(doto (File. "/tmp/remotely-human") .deleteOnExit))
'(deftest ^:unit test-ns-to-map
(is (= (ns-from-map {:ns 'slam.hound}))))))
@@ -44,36 +44,43 @@
(is (= "(ns foo.bar
(:require [clj-schema.validation :as val]))
"
- (reconstruct (StringReader. (str '(ns foo.bar
- (:require [clj-schema.validation :as val]))
- '(val/validation-errors [[:name] String] {:name "Bob"})))))))
+ (reconstruct (StringReader.
+ (str '(ns foo.bar
+ (:require [clj-schema.validation :as val]))
+ '(val/validation-errors [[:name] String]
+ {:name "Bob"})))))))
(deftest ^:integration test-finds-alias-vars-in-nested-maps-and-sets
(is (= "(ns foo.bar
(:require [clj-schema.validation :as val]))
"
- (reconstruct (StringReader. (str '(ns foo.bar
- (:require [clj-schema.validation :as val]))
- '#{:x {:a (val/validation-errors [[:name] String] {:name "Bob"})}}))))))
+ (reconstruct (StringReader.
+ (str '(ns foo.bar
+ (:require [clj-schema.validation :as val]))
+ '#{:x {:a (val/validation-errors
+ [[:name] String]
+ {:name "Bob"})}}))))))
(deftest ^:integration test-prefers-requires-as-clauses-from-orig-ns
- ;; korma.core is on the :dev-dependencies, and was getting erroneously picked for
- ;; these 2 namespaces
+ ;; korma.core is on the :dev-dependencies, and was getting erroneously picked
+ ;; for these 2 namespaces
(testing "original ns has a require/refer"
(is (= "(ns foo.bar
(:require [clojure.string :refer [join]]))
"
- (reconstruct (StringReader. (str '(ns foo.bar
- (:require [clojure.string :refer [join]]))
- '(defn do-it! []
- (join "," ["a" "b" "c"]))))))))
+ (reconstruct (StringReader.
+ (str '(ns foo.bar
+ (:require [clojure.string :refer [join]]))
+ '(defn do-it! []
+ (join "," ["a" "b" "c"]))))))))
(testing "original ns has a use/only"
(is (= "(ns foo.bar
(:require [clojure.string :refer [join]]))
"
- (reconstruct (StringReader. (str '(ns foo.bar
- (:use [clojure.string :only [join]]))
- '(defn do-it! []
- (join "," ["a" "b" "c"])))))))))
+ (reconstruct (StringReader.
+ (str '(ns foo.bar
+ (:use [clojure.string :only [join]]))
+ '(defn do-it! []
+ (join "," ["a" "b" "c"])))))))))

0 comments on commit 89d6aef

Please sign in to comment.
Something went wrong with that request. Please try again.