mirror of https://github.com/fafhrd91/actix-net
test
This commit is contained in:
parent
e1317bb3a0
commit
20f349d9c8
|
@ -571,6 +571,7 @@ mod tests {
|
|||
"/user/{id}",
|
||||
"/v{version}/resource/{id}",
|
||||
"/{id:[[:digit:]]{6}}",
|
||||
"/static",
|
||||
]);
|
||||
assert!(re.is_match("/user/profile"));
|
||||
assert!(re.is_match("/user/2345"));
|
||||
|
@ -601,6 +602,10 @@ mod tests {
|
|||
assert!(!re.is_match("/01234567"));
|
||||
assert!(!re.is_match("/XXXXXX"));
|
||||
|
||||
assert!(re.is_match("/static"));
|
||||
assert!(!re.is_match("/a/static"));
|
||||
assert!(!re.is_match("/static/a"));
|
||||
|
||||
let mut path = Path::new("/012345");
|
||||
assert!(re.match_path(&mut path));
|
||||
assert_eq!(path.get("id").unwrap(), "012345");
|
||||
|
@ -660,6 +665,12 @@ mod tests {
|
|||
assert!(re.is_match("/user/2345"));
|
||||
assert!(re.is_match("/user/2345/"));
|
||||
assert!(re.is_match("/user/2345/sdg"));
|
||||
|
||||
let re = ResourceDef::new("/user/{id}/*");
|
||||
assert!(!re.is_match("/user/2345"));
|
||||
let mut path = Path::new("/user/2345/sdg");
|
||||
assert!(re.match_path(&mut path));
|
||||
assert_eq!(path.get("id").unwrap(), "2345");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue