Permalink
Browse files

Moved clout to clout.core, now uses clojure.test for testing

  • Loading branch information...
weavejester committed Feb 27, 2010
1 parent 9dd21bb commit 991ebcc31f41aa2d99fc2c7d6bffc5323e264c15
Showing with 14 additions and 19 deletions.
  1. +1 −1 project.clj
  2. +3 −3 src/{clout.clj → clout/core.clj}
  3. +10 −10 test/{clout.clj → clout/core_test.clj}
  4. +0 −5 test/main.clj
View
@@ -1,4 +1,4 @@
-(defproject clout "0.1"
+(defproject clout "0.2.0-SNAPSHOT"
:description "A HTTP route matching library"
:url "http://github.com/weavejester/clout"
:dependencies [[org.clojure/clojure "1.1.0"]]
@@ -6,10 +6,10 @@
;; terms of this license. You must not remove this notice, or any other, from
;; this software.
-(ns clout
+(ns clout.core
"Library for parsing the Rails routes syntax."
- (:import java.util.Map)
- (:import java.net.URLDecoder))
+ (:import java.util.Map
+ java.net.URLDecoder))
;; Regular expression utilties
@@ -1,9 +1,9 @@
-(ns test.clout
- (:use clojure.contrib.test-is)
- (:use clout))
+(ns clout.core-test
+ (:use clojure.test
+ clout.core))
(deftest fixed-path
- (are (route-matches _1 _1)
+ (are [path] (route-matches path path)
"/"
"/foo"
"/foo/bar"
@@ -13,34 +13,34 @@
(is (route-matches "/" nil)))
(deftest keyword-paths
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/:x" "/foo" {:x "foo"}
"/foo/:x" "/foo/bar" {:x "bar"}
"/a/b/:c" "/a/b/c" {:c "c"}
"/:a/b/:c" "/a/b/c" {:a "a", :c "c"}))
(deftest keywords-match-extensions
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/foo.:ext" "/foo.txt" {:ext "txt"}
"/:x.:y" "/foo.txt" {:x "foo", :y "txt"}))
(deftest hyphen-keywords
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/:foo-bar" "/baz" {:foo-bar "baz"}
"/:foo-" "/baz" {:foo- "baz"}))
(deftest urlencoded-keywords
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/:x" "/foo%20bar" {:x "foo bar"}
"/:x" "/foo+bar" {:x "foo bar"}))
(deftest same-keyword-many-times
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/:x/:x/:x" "/a/b/c" {:x ["a" "b" "c"]}
"/:x/b/:x" "/a/b/c" {:x ["a" "c"]}))
(deftest wildcard-paths
- (are (= (route-matches _1 _2) _3)
+ (are [path uri params] (= (route-matches path uri) params)
"/*" "/foo" {:* "foo"}
"/*" "/foo.txt" {:* "foo.txt"}
"/*" "/foo/bar" {:* "foo/bar"}
View
@@ -1,5 +0,0 @@
-(ns test.main
- (:use clojure.contrib.test-is)
- (:require test.clout))
-
-(run-tests 'test.clout)

0 comments on commit 991ebcc

Please sign in to comment.