Permalink
Browse files

windows-safe test for relative-path-string

  • Loading branch information...
1 parent 4f9a78d commit ebf0d212dcc076ebee6984d276ff037ce1a7ecbe @stuarthalloway stuarthalloway committed Apr 13, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/test/clojure/clojure/contrib/test_io.clj
View
10 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")))))))

0 comments on commit ebf0d21

Please sign in to comment.