summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Smith-Mannschott <bsmith.occs@gmail.com>2010-07-25 10:45:12 +0200
committerStuart Halloway <stu@thinkrelevance.com>2010-07-27 16:50:56 -0400
commit278af620d00907c24999b69131adaef95f804988 (patch)
treebe1ca3ceb22348df067d9d7dc4e2eb78096aee59 /test
parent4d8932507a4f914d3bbdab738aa2decad1403d03 (diff)
♯413 parse-args defaults in-enc and out-enc to UTF-8, as required by sh
Previously parse-args was defaulting in-enc and out-enc to the platform default charset. This contradicted the intent of sh, which is to default to UTF-8 on all platforms. This appears not to have been noticed because the unit tests were still testing for the previous behavior of defaulting to platform encoding. (As it turns out the old behavior of using Charset/defaultCharset would have been wrong on Mac OS X since it claims "Mac Roman" here despite the fact that Mac OS X uses UTF-8 throughout, including in Terminal.app, shell and file system.) Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
Diffstat (limited to 'test')
-rw-r--r--test/clojure/test_clojure/java/shell.clj10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/clojure/test_clojure/java/shell.clj b/test/clojure/test_clojure/java/shell.clj
index d3db7db0..56e3ff04 100644
--- a/test/clojure/test_clojure/java/shell.clj
+++ b/test/clojure/test_clojure/java/shell.clj
@@ -12,13 +12,15 @@
(:import (java.io File)))
(def platform-enc (.name (java.nio.charset.Charset/defaultCharset)))
+(def default-enc "UTF-8")
(deftest test-parse-args
(are [x y] (= x y)
- [[] {:in-enc platform-enc :out-enc platform-enc :dir nil :env nil}] (#'sh/parse-args [])
- [["ls"] {:in-enc platform-enc :out-enc platform-enc :dir nil :env nil}] (#'sh/parse-args ["ls"])
- [["ls" "-l"] {:in-enc platform-enc :out-enc platform-enc :dir nil :env nil}] (#'sh/parse-args ["ls" "-l"])
- [["ls"] {:in-enc platform-enc :out-enc "ISO-8859-1" :dir nil :env nil}] (#'sh/parse-args ["ls" :out-enc "ISO-8859-1"])))
+ [[] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args [])
+ [["ls"] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args ["ls"])
+ [["ls" "-l"] {:in-enc default-enc :out-enc default-enc :dir nil :env nil}] (#'sh/parse-args ["ls" "-l"])
+ [["ls"] {:in-enc default-enc :out-enc "ISO-8859-1" :dir nil :env nil}] (#'sh/parse-args ["ls" :out-enc "ISO-8859-1"])
+ [[] {:in-enc platform-enc :out-enc platform-enc :dir nil :env nil}] (#'sh/parse-args [:in-enc platform-enc :out-enc platform-enc])))
(deftest test-with-sh-dir
(are [x y] (= x y)