Permalink
Browse files

Update tests for route maps using string keys instead of keywords

  • Loading branch information...
1 parent 85da4dc commit 757467825862591a3caeb47416f6ec9f1d1ee3de abhishek committed with weavejester Apr 20, 2010
Showing with 18 additions and 18 deletions.
  1. +18 −18 test/clout/core_test.clj
View
36 test/clout/core_test.clj
@@ -14,42 +14,42 @@
(deftest keyword-paths
(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"}))
+ "/: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 [path uri params] (= (route-matches path uri) params)
- "/foo.:ext" "/foo.txt" {:ext "txt"}
- "/:x.:y" "/foo.txt" {:x "foo", :y "txt"}))
+ "/foo.:ext" "/foo.txt" {"ext" "txt"}
+ "/:x.:y" "/foo.txt" {"x" "foo", "y" "txt"}))
(deftest hyphen-keywords
(are [path uri params] (= (route-matches path uri) params)
- "/:foo-bar" "/baz" {:foo-bar "baz"}
- "/:foo-" "/baz" {:foo- "baz"}))
+ "/:foo-bar" "/baz" {"foo-bar" "baz"}
+ "/:foo-" "/baz" {"foo-" "baz"}))
(deftest urlencoded-keywords
(are [path uri params] (= (route-matches path uri) params)
- "/:x" "/foo%20bar" {:x "foo bar"}
- "/:x" "/foo+bar" {:x "foo bar"}))
+ "/:x" "/foo%20bar" {"x" "foo bar"}
+ "/:x" "/foo+bar" {"x" "foo bar"}))
(deftest same-keyword-many-times
(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"]}))
+ "/:x/:x/:x" "/a/b/c" {"x" ["a" "b" "c"]}
+ "/:x/b/:x" "/a/b/c" {"x" ["a" "c"]}))
(deftest wildcard-paths
(are [path uri params] (= (route-matches path uri) params)
- "/*" "/foo" {:* "foo"}
- "/*" "/foo.txt" {:* "foo.txt"}
- "/*" "/foo/bar" {:* "foo/bar"}
- "/foo/*" "/foo/bar/baz" {:* "bar/baz"}
- "/a/*/d" "/a/b/c/d" {:* "b/c"}))
+ "/*" "/foo" {"*" "foo"}
+ "/*" "/foo.txt" {"*" "foo.txt"}
+ "/*" "/foo/bar" {"*" "foo/bar"}
+ "/foo/*" "/foo/bar/baz" {"*" "bar/baz"}
+ "/a/*/d" "/a/b/c/d" {"*" "b/c"}))
(deftest compiled-routes
(is (= (route-matches (route-compile "/foo/:id") "/foo/bar")
- {:id "bar"})))
+ {"id" "bar"})))
(deftest url-paths
(is (route-matches "http://localhost" "http://localhost")))

0 comments on commit 7574678

Please sign in to comment.