@@ -37,6 +37,16 @@ let%expect_test "duplicate paramters" =
3737 [% expect {| [FAIL ] invalid route duplicate parameter " bar" | }]
3838;;
3939
40+ let % expect_test " splat in the middle is wrong" =
41+ valid_route " /foo/**/foo" ;
42+ [% expect {| [FAIL ] invalid route double splat allowed only in the end | }]
43+ ;;
44+
45+ let % expect_test " splat at the end" =
46+ valid_route " /foo/**" ;
47+ [% expect {| [PASS ] valid route | }]
48+ ;;
49+
4050let test_match_url router url =
4151 match Router. match_url router url with
4252 | None -> print_endline " no match"
@@ -93,7 +103,7 @@ let%expect_test "ambiguity in routes" =
93103 (Failure " duplicate routes" )
94104 Raised at Stdlib. failwith in file " stdlib.ml" , line 29 , characters 17-33
95105 Called from Stdlib__list. fold_left in file " list.ml" , line 121 , characters 24-34
96- Called from Opium_tests__Opium_router_tests. (fun) in file " opium/test/opium_router_tests.ml" , line 85 , characters 2-49
106+ Called from Opium_tests__Opium_router_tests. (fun) in file " opium/test/opium_router_tests.ml" , line 95 , characters 2-49
97107 Called from Expect_test_collector.Make.Instance. exec in file " collector/expect_test_collector.ml" , line 244 , characters 12-19 | }]
98108;;
99109
@@ -109,7 +119,7 @@ let%expect_test "ambiguity in routes 2" =
109119 (Failure " duplicate routes" )
110120 Raised at Stdlib. failwith in file " stdlib.ml" , line 29 , characters 17-33
111121 Called from Stdlib__list. fold_left in file " list.ml" , line 121 , characters 24-34
112- Called from Opium_tests__Opium_router_tests. (fun) in file " opium/test/opium_router_tests.ml" , line 101 , characters 2-43
122+ Called from Opium_tests__Opium_router_tests. (fun) in file " opium/test/opium_router_tests.ml" , line 111 , characters 2-43
113123 Called from Expect_test_collector.Make.Instance. exec in file " collector/expect_test_collector.ml" , line 244 , characters 12-19 | }]
114124;;
115125
0 commit comments