Permalink
Browse files

string fns take an object, you can't pass nil #359

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent 8ac69ed commit 314aa4caa0a72ea4f5497b2ce0900aff1c48d898 @stuarthalloway stuarthalloway committed May 30, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/clojure/test_clojure/string.clj
@@ -59,3 +59,17 @@
(deftest t-lower-case
(is (= "foobar" (s/lower-case "FooBar"))))
+(deftest nil-handling
+ (are [f args] (thrown? NullPointerException (apply f args))
+ s/reverse [nil]
+ s/replace [nil #"foo" "bar"]
+ s/replace-first [nil #"foo" "bar"]
+ s/capitalize [nil]
+ s/upper-case [nil]
+ s/lower-case [nil]
+ s/split [nil #"-"]
+ s/split [nil #"-" 1]
+ s/trim [nil]
+ s/triml [nil]
+ s/trimr [nil]
+ s/trim-newline [nil]))

0 comments on commit 314aa4c

Please sign in to comment.