aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2010-04-12 20:34:47 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-04-12 20:34:47 -0400
commitebf0d212dcc076ebee6984d276ff037ce1a7ecbe (patch)
treee2c3766e3c12521c8c7cdabc2839ff1170b2eab7
parent4f9a78d13217a8de4c29221d74aca0a67cec8c1a (diff)
windows-safe test for relative-path-string
-rw-r--r--src/test/clojure/clojure/contrib/test_io.clj10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/clojure/clojure/contrib/test_io.clj b/src/test/clojure/clojure/contrib/test_io.clj
index 199cbfc5..30ccd4a5 100644
--- a/src/test/clojure/clojure/contrib/test_io.clj
+++ b/src/test/clojure/clojure/contrib/test_io.clj
@@ -31,3 +31,13 @@
(is (thrown? ArithmeticException (/ 1 0)))
(is (thrown? java.io.IOException (delete-file not-file)))
(is (delete-file not-file :silently))))
+
+(deftest test-relative-path-string
+ (testing "strings"
+ (is (= "foo" (relative-path-string "foo"))))
+ (testing "absolute path strings are forbidden"
+ (is (thrown? IllegalArgumentException (relative-path-string (str File/separator "baz")))))
+ (testing "relative File paths"
+ (is (= "bar" (relative-path-string (File. "bar")))))
+ (testing "absolute File paths are forbidden"
+ (is (thrown? IllegalArgumentException (relative-path-string (File. (str File/separator "quux")))))))