Mercurial > lasercutter
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 ; Copyright (c) Rich Hickey. All rights reserved. | |
2 ; The use and distribution terms for this software are covered by the | |
3 ; 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 by | |
6 ; the terms of this license. | |
7 ; You must not remove this notice, or any other, from this software. | |
8 | |
9 (ns clojure.test-clojure.java.shell | |
10 (:use clojure.test | |
11 [clojure.java.shell :as sh]) | |
12 (:import (java.io File))) | |
13 | |
14 (def platform-enc (.name (java.nio.charset.Charset/defaultCharset))) | |
15 (def default-enc "UTF-8") | |
16 | |
17 (deftest test-parse-args | |
18 (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]))) | |
24 | |
25 (deftest test-with-sh-dir | |
26 (are [x y] (= x y) | |
27 nil *sh-dir* | |
28 "foo" (with-sh-dir "foo" *sh-dir*))) | |
29 | |
30 (deftest test-with-sh-env | |
31 (are [x y] (= x y) | |
32 nil *sh-env* | |
33 {:KEY "VAL"} (with-sh-env {:KEY "VAL"} *sh-env*))) | |
34 | |
35 (deftest test-as-env-strings | |
36 (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"})))) | |
41 |