@@ -75,7 +75,7 @@ let%expect_test "we can add & match literal routes" =
7575 let router = add empty route () in
7676 test_match_url router url;
7777 [%expect {|
78- matched with params: ((named ()) (unnamed ())) |}]
78+ matched with params: ((named ()) (unnamed ()) (full_splat ()) ) |}]
7979;;
8080
8181let%expect_test "we can extract parameter after match" =
@@ -84,9 +84,8 @@ let%expect_test "we can extract parameter after match" =
8484 test_match_url router "/foo/100/baz";
8585 test_match_url router "/foo/100";
8686 test_match_url router "/foo/100/200/300";
87- [%expect
88- {|
89- matched with params: ((named ((bar baz))) (unnamed (100)))
87+ [%expect {|
88+ matched with params: ((named ((bar baz))) (unnamed (100)) (full_splat ()))
9089 no match
9190 no match |}]
9291;;
@@ -112,7 +111,7 @@ let%expect_test "ambiguity in routes" =
112111 (Failure "duplicate routes")
113112 Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
114113 Called from Stdlib__list.fold_left in file "list.ml", line 121, characters 24-34
115- Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 104 , characters 2-49
114+ Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 135 , characters 2-49
116115 Called from Expect_test_collector.Make.Instance.exec in file "collector/expect_test_collector.ml", line 244, characters 12-19 |}]
117116;;
118117
@@ -128,7 +127,7 @@ let%expect_test "ambiguity in routes 2" =
128127 (Failure "duplicate routes")
129128 Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
130129 Called from Stdlib__list.fold_left in file "list.ml", line 121, characters 24-34
131- Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 120 , characters 2-43
130+ Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 151 , characters 2-43
132131 Called from Expect_test_collector.Make.Instance.exec in file "collector/expect_test_collector.ml", line 244, characters 12-19 |}]
133132;;
134133
@@ -144,7 +143,8 @@ let%expect_test "nodes are matched correctly" =
144143 let test = test_match router in
145144 test "/foo/bar" "Wrong";
146145 test "/foo/baz" "Right";
147- [%expect {| |}]
146+ [%expect
147+ {| |}]
148148;;
149149
150150let%expect_test "full splat node matches" =
@@ -153,11 +153,10 @@ let%expect_test "full splat node matches" =
153153 test "/foo/bar";
154154 test "/foo/bar/foo";
155155 test "/foo/";
156- [%expect
157- {|
158- matched with params: ((named ()) (unnamed (bar)))
159- matched with params: ((named ()) (unnamed (bar foo)))
160- matched with params: ((named ()) (unnamed (""))) |}]
156+ [%expect {|
157+ matched with params: ((named ()) (unnamed ()) (full_splat (bar)))
158+ matched with params: ((named ()) (unnamed ()) (full_splat (bar/foo)))
159+ matched with params: ((named ()) (unnamed ()) (full_splat ())) |}]
161160;;
162161
163162let%expect_test "full splat + collision checking" =
@@ -172,18 +171,17 @@ let%expect_test "full splat + collision checking" =
172171 (Failure "duplicate routes")
173172 Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
174173 Called from Stdlib__list.fold_left in file "list.ml", line 121, characters 24-34
175- Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 164 , characters 9-45
174+ Called from Opium_tests__Opium_router_tests.(fun) in file "opium/test/opium_router_tests.ml", line 211 , characters 9-45
176175 Called from Expect_test_collector.Make.Instance.exec in file "collector/expect_test_collector.ml", line 244, characters 12-19 |}]
177176;;
178177
179178let%expect_test "two parameters" =
180179 let router = of_routes' [ "/test/:format/:name/:baz" ] in
181180 let test = test_match_url router in
182181 test "/test/json/bar/blah";
183- [%expect
184- {|
182+ [%expect {|
185183 matched with params: ((named ((baz blah) (name bar) (format json)))
186- (unnamed ())) |}]
184+ (unnamed ()) (full_splat ()) ) |}]
187185;;
188186
189187let%expect_test "full splat" =
@@ -194,11 +192,11 @@ let%expect_test "full splat" =
194192 test "/";
195193 test "";
196194 test "/user/123/foo/bar";
197- [%expect
198- {|
199- matched with params: ((named ()) (unnamed (test)))
200- matched with params: ((named ()) (unnamed (test "" )))
201- matched with params: ((named ()) (unnamed ("" )))
202- matched with params: ((named ()) (unnamed ()))
203- matched with params: ((named ()) (unnamed (user 123 foo bar))) |}]
195+ [%expect{|
196+ matched with params: ((named ()) (unnamed ()) (full_splat (test)))
197+ matched with params: ((named ()) (unnamed ()) (full_splat ( test/ )))
198+ matched with params: ((named ()) (unnamed ()) (full_splat ( )))
199+ matched with params: ((named ()) (unnamed ()) (full_splat ( )))
200+ matched with params: ((named ()) (unnamed ())
201+ (full_splat (user/ 123/ foo/ bar))) |}]
204202;;
0 commit comments