diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2010-02-01 11:53:56 -0500 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2010-02-01 12:42:47 -0500 |
commit | 1ab0a226435581e162efe55c02b4eae99a507651 (patch) | |
tree | 918bade9cb3e4c2ff4ba75be03994f1ed370bac0 | |
parent | e9269d207876380249bfa535081657ec08021194 (diff) |
Remove old str-utils lib tests.
-rw-r--r-- | src/test/clojure/clojure/contrib/test_contrib/str_utils.clj | 33 | ||||
-rw-r--r-- | src/test/clojure/clojure/contrib/test_contrib/str_utils2.clj | 119 |
2 files changed, 0 insertions, 152 deletions
diff --git a/src/test/clojure/clojure/contrib/test_contrib/str_utils.clj b/src/test/clojure/clojure/contrib/test_contrib/str_utils.clj deleted file mode 100644 index 1a7787b6..00000000 --- a/src/test/clojure/clojure/contrib/test_contrib/str_utils.clj +++ /dev/null @@ -1,33 +0,0 @@ -(ns clojure.contrib.test-contrib.string - (:use clojure.test - clojure.contrib.string)) - - -(deftest test-re-gsub - (let [re #"\%([0-9a-fA-F]{2})" - replacement (fn [match] - (char (Integer/parseInt - (match 1) 16)))] - (is (= (re-gsub re replacement "") "")) - (is (= (re-gsub re replacement "%20") " ")) - (is (= (re-gsub re replacement "x%20") "x ")) - (is (= (re-gsub re replacement "x%20%0a") "x \n")) - (is (= (re-gsub re replacement "x%20y") "x y")) - (is (= (re-gsub re "?" "") "")) - (is (= (re-gsub re "?" "%21") "?")) - (is (= (re-gsub re "?" "x%22") "x?")) - (is (= (re-gsub re "?" "x%23y") "x?y")))) - -(deftest test-re-sub - (let [re #"\%([0-9a-fA-F]{2})" - replacement (fn [match] - (char (Integer/parseInt - (match 1) 16)))] - (is (= (re-sub re replacement "") "")) - (is (= (re-sub re replacement "%20") " ")) - (is (= (re-sub re replacement "x%20%20") "x %20")) - (is (= (re-sub re replacement "x%20y") "x y")) - (is (= (re-sub re "?" "") "")) - (is (= (re-sub re "?" "%21") "?")) - (is (= (re-sub re "?" "x%22%25") "x?%25")) - (is (= (re-gsub re "?" "x%23y") "x?y")))) diff --git a/src/test/clojure/clojure/contrib/test_contrib/str_utils2.clj b/src/test/clojure/clojure/contrib/test_contrib/str_utils2.clj deleted file mode 100644 index b20f402f..00000000 --- a/src/test/clojure/clojure/contrib/test_contrib/str_utils2.clj +++ /dev/null @@ -1,119 +0,0 @@ -(ns clojure.contrib.test-contrib.string - (:require [clojure.contrib.string :as s]) - (:use clojure.test)) - -(deftest t-codepoints - (is (= (list 102 111 111 65536 98 97 114) - (s/codepoints "foo\uD800\uDC00bar")) - "Handles Unicode supplementary characters")) - -(deftest t-escape - (is (= "<foo&bar>" - (s/escape "<foo&bar>" {\& "&" \< "<" \> ">"}))) - (is (= " \\\"foo\\\" " - (s/escape " \"foo\" " {\" "\\\""}))) - (is (= "faabor" (s/escape "foobar" {\a \o, \o \a})))) - -(deftest t-blank - (is (s/blank? nil)) - (is (s/blank? "")) - (is (s/blank? " ")) - (is (s/blank? " \t \n \r ")) - (is (not (s/blank? " foo ")))) - -(deftest t-take - (is (= "foo" (s/take "foobar" 3))) - (is (= "foobar" (s/take "foobar" 7))) - (is (= "" (s/take "foo" 0)))) - -(deftest t-drop - (is (= "bar" (s/drop "foobar" 3))) - (is (= "" (s/drop "foobar" 9))) - (is (= "foobar" (s/drop "foobar" 0)))) - -(deftest t-butlast - (is (= "foob" (s/butlast "foobar" 2))) - (is (= "" (s/butlast "foobar" 9))) - (is (= "foobar" (s/butlast "foobar" 0)))) - -(deftest t-tail - (is (= "ar" (s/tail "foobar" 2))) - (is (= "foobar" (s/tail "foobar" 9))) - (is (= "" (s/tail "foobar" 0)))) - -(deftest t-repeat - (is (= "foofoofoo" (s/repeat "foo" 3)))) - -(deftest t-reverse - (is (= "tab" (s/reverse "bat")))) - -(deftest t-replace - (is (= "faabar" (s/replace "foobar" \o \a))) - (is (= "barbarbar" (s/replace "foobarfoo" "foo" "bar"))) - (is (= "FOObarFOO" (s/replace "foobarfoo" #"foo" s/upper-case)))) - -(deftest t-replace-first - (is (= "barbarfoo" (s/replace-first "foobarfoo" #"foo" "bar"))) - (is (= "FOObarfoo" (s/replace-first "foobarfoo" #"foo" s/upper-case)))) - -(deftest t-partition - (is (= (list "" "abc" "123" "def") - (s/partition "abc123def" #"[a-z]+")))) - -(deftest t-join - (is (= "1,2,3" (s/join \, [1 2 3]))) - (is (= "" (s/join \, []))) - (is (= "1 and-a 2 and-a 3" (s/join " and-a " [1 2 3])))) - -(deftest t-chop - (is (= "fo" (s/chop "foo"))) - (is (= "") (s/chop "f")) - (is (= "") (s/chop ""))) - -(deftest t-chomp - (is (= "foo" (s/chomp "foo\n"))) - (is (= "foo" (s/chomp "foo\r\n"))) - (is (= "foo" (s/chomp "foo"))) - (is (= "" (s/chomp "")))) - -(deftest t-swap-case - (is (= "fOO!bAR" (s/swap-case "Foo!Bar"))) - (is (= "" (s/swap-case "")))) - -(deftest t-capitalize - (is (= "Foobar" (s/capitalize "foobar"))) - (is (= "Foobar" (s/capitalize "FOOBAR")))) - -(deftest t-ltrim - (is (= "foo " (s/ltrim " foo "))) - (is (= "" (s/ltrim " ")))) - -(deftest t-rtrim - (is (= " foo" (s/rtrim " foo "))) - (is (= "" (s/rtrim " ")))) - -(deftest t-split-lines - (is (= (list "one" "two" "three") - (s/split-lines "one\ntwo\r\nthree"))) - (is (= (list "foo") (s/split-lines "foo")))) - -(deftest t-upper-case - (is (= "FOOBAR" (s/upper-case "Foobar")))) - -(deftest t-lower-case - (is (= "foobar" (s/lower-case "FooBar")))) - -(deftest t-trim - (is (= "foo" (s/trim " foo \r\n")))) - -(deftest t-contains - (is (s/contains? "foobar" "foo")) - (is (not (s/contains? "foobar" "baz")))) - -(deftest t-get - (is (= \o (s/get "foo" 1)))) - -(deftest t-partial - (is (= "bar" ((s/partial s/drop 3) "foobar"))) - (is (= "ooba" ((comp (s/partial s/take 4) - (s/partial s/drop 1)) "foobar")))) |