Mercurial > lasercutter
view src/clojure/test_clojure/java/shell.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 ; Copyright (c) Rich Hickey. All rights reserved.2 ; The use and distribution terms for this software are covered by the3 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)4 ; which can be found in the file epl-v10.html at the root of this distribution.5 ; By using this software in any fashion, you are agreeing to be bound by6 ; the terms of this license.7 ; You must not remove this notice, or any other, from this software.9 (ns clojure.test-clojure.java.shell10 (:use clojure.test11 [clojure.java.shell :as sh])12 (:import (java.io File)))14 (def platform-enc (.name (java.nio.charset.Charset/defaultCharset)))15 (def default-enc "UTF-8")17 (deftest test-parse-args18 (are [x y] (= x y)19 [[] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args [])20 [["ls"] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args ["ls"])21 [["ls" "-l"] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args ["ls" "-l"])22 [["ls"] {:in-enc default-enc :out-enc "ISO-8859-1" :dir nil :env nil}] (#'sh/parse-args ["ls" :out-enc "ISO-8859-1"])23 [[] {:in-enc platform-enc :out-enc platform-enc :dir nil :env nil}] (#'sh/parse-args [:in-enc platform-enc :out-enc platform-enc])))25 (deftest test-with-sh-dir26 (are [x y] (= x y)27 nil *sh-dir*28 "foo" (with-sh-dir "foo" *sh-dir*)))30 (deftest test-with-sh-env31 (are [x y] (= x y)32 nil *sh-env*33 {:KEY "VAL"} (with-sh-env {:KEY "VAL"} *sh-env*)))35 (deftest test-as-env-strings36 (are [x y] (= x y)37 nil (#'sh/as-env-strings nil)38 ["FOO=BAR"] (seq (#'sh/as-env-strings {"FOO" "BAR"}))39 ["FOO_SYMBOL=BAR"] (seq (#'sh/as-env-strings {'FOO_SYMBOL "BAR"}))40 ["FOO_KEYWORD=BAR"] (seq (#'sh/as-env-strings {:FOO_KEYWORD "BAR"}))))