INNER CODE UNIT · Rust
it_creates_complex_catch_all_route
vercel-community/rust · crates/vercel_runtime_router/src/lib.rs:364
fn it_creates_complex_catch_all_route() {
let path = "api/[dyn]/handler/[...all]";
let route = Route::from(path);
assert!(matches!(route.kind, RouteKind::CatchAll));
assert_eq!(route.path, path);
assert!(route.segments.is_some());
assert_eq!(
route.segments.unwrap(),
vec!["api", "[dyn]", "handler", "[...all]"]
);
}
#[test]
fn it_creates_optional_catch_all_route() {
let path = "api/[[...all]]";
let route = Route::from(path);
assert!(matches!(route.kind, RouteKind::OptionalCatchAll));
assert_eq!(route.path, path);