From 8397dbff88f6bf86688c1be7cc07f20d2bfbb6af Mon Sep 17 00:00:00 2001 From: Stuart Sierra Date: Fri, 16 Jan 2009 18:12:43 +0000 Subject: test_is/tests.clj: added regular expression tests --- src/clojure/contrib/test_is/tests.clj | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/clojure') 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) -- cgit v1.2.3-70-g09d2