diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2009-01-16 18:12:43 +0000 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2009-01-16 18:12:43 +0000 |
commit | 8397dbff88f6bf86688c1be7cc07f20d2bfbb6af (patch) | |
tree | d8612e3c93d69500b7eca4eb2ab4d1d7c7d0c4a1 | |
parent | 755183064f66b99ea5660434492d43a7538ce3a6 (diff) |
test_is/tests.clj: added regular expression tests
-rw-r--r-- | src/clojure/contrib/test_is/tests.clj | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/clojure/contrib/test_is/tests.clj b/src/clojure/contrib/test_is/tests.clj index 1b80ec3c..5b04c91a 100644 --- a/src/clojure/contrib/test_is/tests.clj +++ b/src/clojure/contrib/test_is/tests.clj @@ -1,7 +1,7 @@ ;;; test_is/tests.clj: unit tests for test_is.clj ;; by Stuart Sierra, http://stuartsierra.com/ -;; January 15, 2009 +;; January 16, 2009 ;; Thanks to Chas Emerick, Allen Rohner, and Stuart Halloway for ;; contributions and suggestions. @@ -55,10 +55,16 @@ (is (#(.startsWith % "a") "abc") "Should pass") (is (#(.startsWith % "d") "abc") "Should fail")) +(deftest can-test-regexps + (is (re-matches #"^ab.*$" "abbabba") "Should pass") + (is (re-matches #"^cd.*$" "abbabba") "Should fail") + (is (re-find #"ab" "abbabba") "Should pass") + (is (re-find #"cd" "abbabba") "Should fail")) + ;; Here, we create an alternate version of test-is/report, that -;; compares the event with the message. The alternate calls the -;; original with modified arguments. +;; compares the event with the message, then calls the original +;; 'report' with modified arguments. (declare original-report) |