summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2010-05-25 22:41:15 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-05-28 07:52:54 -0400
commit46701cdb79d3e6e1b03e40f7e58f1019dc69be43 (patch)
treee902901dd31873c83a70d30b2681c22fed1ba020
parent68658ce44f0678dc3940b9a3537ba60466ad7a8b (diff)
related tests from contrib
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--test/clojure/test_clojure/java/shell.clj29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/clojure/test_clojure/java/shell.clj b/test/clojure/test_clojure/java/shell.clj
new file mode 100644
index 00000000..a8c6f0a0
--- /dev/null
+++ b/test/clojure/test_clojure/java/shell.clj
@@ -0,0 +1,29 @@
+(ns clojure.test-clojure.java.shell
+ (:use clojure.test
+ [clojure.java.shell :as sh])
+ (:import (java.io File)))
+
+(deftest test-parse-args
+ (are [x y] (= x y)
+ {:cmd [nil] :out "UTF-8" :dir nil :env nil} (#'sh/parse-args [])
+ {:cmd ["ls"] :out "UTF-8" :dir nil :env nil} (#'sh/parse-args ["ls"])
+ {:cmd ["ls" "-l"] :out "UTF-8" :dir nil :env nil} (#'sh/parse-args ["ls" "-l"])
+ {:cmd ["ls"] :out "ISO-8859-1" :dir nil :env nil} (#'sh/parse-args ["ls" :out "ISO-8859-1"])))
+
+(deftest test-with-sh-dir
+ (are [x y] (= x y)
+ nil *sh-dir*
+ "foo" (with-sh-dir "foo" *sh-dir*)))
+
+(deftest test-with-sh-env
+ (are [x y] (= x y)
+ nil *sh-env*
+ {:KEY "VAL"} (with-sh-env {:KEY "VAL"} *sh-env*)))
+
+(deftest test-as-env-string
+ (are [x y] (= x y)
+ nil (#'sh/as-env-string nil)
+ ["FOO=BAR"] (seq (#'sh/as-env-string {"FOO" "BAR"}))
+ ["FOO_SYMBOL=BAR"] (seq (#'sh/as-env-string {'FOO_SYMBOL "BAR"}))
+ ["FOO_KEYWORD=BAR"] (seq (#'sh/as-env-string {:FOO_KEYWORD "BAR"}))))
+