Test unicode chars

This commit is contained in:
Tommi Reiman 2019-02-09 16:04:41 +02:00
parent ae1a8f7919
commit 8abca179d0

View file

@ -100,7 +100,8 @@
["/abba/{dabba}/boo" ::boo] ["/abba/{dabba}/boo" ::boo]
["/{a/jabba}/{a.b/dabba}/{a.b.c/doo}/{a.b.c.d/daa}/{*foo/bar}" ::wild] ["/{a/jabba}/{a.b/dabba}/{a.b.c/doo}/{a.b.c.d/daa}/{*foo/bar}" ::wild]
["/files/file-{name}.html" ::html] ["/files/file-{name}.html" ::html]
["/files/file-{name}.json" ::json]] ["/files/file-{name}.json" ::json]
["/{eskon}/{saum}/pium\u2215paum" ::loru]]
{:router r}) {:router r})
by-path #(-> router (r/match-by-path %) ((juxt (comp :name :data) :path-params)))] by-path #(-> router (r/match-by-path %) ((juxt (comp :name :data) :path-params)))]
(is (= [::abba {:abba "abba"}] (by-path "/abba"))) (is (= [::abba {:abba "abba"}] (by-path "/abba")))
@ -116,7 +117,9 @@
:a.b.c.d/daa "vaan" :a.b.c.d/daa "vaan"
:foo/bar "ei/toista/kertaa"}] :foo/bar "ei/toista/kertaa"}]
(by-path "/olipa/kerran/avaruus/vaan/ei/toista/kertaa"))) (by-path "/olipa/kerran/avaruus/vaan/ei/toista/kertaa")))
(is (= [::html {:name "10"}] (by-path "/files/file-10.html"))))) (is (= [::html {:name "10"}] (by-path "/files/file-10.html")))
(is (= [::loru {:eskon "viitan", :saum "aa"}] (by-path "/viitan/aa/pium\u2215paum")))
(is (= [nil nil] (by-path "/ei/osu/pium/paum")))))
(testing "invalid syntax fails fast" (testing "invalid syntax fails fast"
(testing "unbalanced brackets" (testing "unbalanced brackets"