mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update tests
This commit is contained in:
parent
a83d9b24ae
commit
86d7290f9e
@ -395,11 +395,11 @@ mod tests {
|
|||||||
let mut rec = RouteRecognizer::<usize>::default();
|
let mut rec = RouteRecognizer::<usize>::default();
|
||||||
|
|
||||||
let routes = vec![
|
let routes = vec![
|
||||||
("/name", 1),
|
("/name", None, 1),
|
||||||
("/name/{val}", 2),
|
("/name/{val}", None, 2),
|
||||||
("/name/{val}/index.html", 3),
|
("/name/{val}/index.html", None, 3),
|
||||||
("/v{val}/{val2}/index.html", 4),
|
("/v{val}/{val2}/index.html", None, 4),
|
||||||
("/v/{tail:.*}", 5),
|
("/v/{tail:.*}", None, 5),
|
||||||
];
|
];
|
||||||
rec.set_routes(routes);
|
rec.set_routes(routes);
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn assert_parse(pattern: &str, expected_re: &str) -> Regex {
|
fn assert_parse(pattern: &str, expected_re: &str) -> Regex {
|
||||||
let re_str = parse(pattern);
|
let (re_str, _) = parse(pattern);
|
||||||
assert_eq!(&*re_str, expected_re);
|
assert_eq!(&*re_str, expected_re);
|
||||||
Regex::new(&re_str).unwrap()
|
Regex::new(&re_str).unwrap()
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ fn test_request_match_info() {
|
|||||||
let mut req = HttpRequest::new(Method::GET, Uri::from_str("/value/?id=test").unwrap(),
|
let mut req = HttpRequest::new(Method::GET, Uri::from_str("/value/?id=test").unwrap(),
|
||||||
Version::HTTP_11, HeaderMap::new(), Payload::empty());
|
Version::HTTP_11, HeaderMap::new(), Payload::empty());
|
||||||
|
|
||||||
let rec = RouteRecognizer::new("/".to_owned(), vec![("/{key}/".to_owned(), 1)]);
|
let rec = RouteRecognizer::new("/".to_owned(), vec![("/{key}/".to_owned(), None, 1)]);
|
||||||
let (params, _) = rec.recognize(req.path()).unwrap();
|
let (params, _) = rec.recognize(req.path()).unwrap();
|
||||||
let params = params.unwrap();
|
let params = params.unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user