Add path_match tests

This commit is contained in:
Manish Goregaokar 2015-11-30 22:56:13 +05:30
parent f8d906be10
commit d332557d69

View file

@ -25,6 +25,23 @@ fn test_domain_match() {
assert!(!Cookie::domain_match("235.132.2.3", ".2.3"));
}
#[test]
fn test_path_match() {
assert!(Cookie::path_match("/", "/"));
assert!(Cookie::path_match("/index.html", "/"));
assert!(Cookie::path_match("/w/index.html", "/"));
assert!(Cookie::path_match("/w/index.html", "/w/index.html"));
assert!(Cookie::path_match("/w/index.html", "/w/"));
assert!(Cookie::path_match("/w/index.html", "/w"));
assert!(!Cookie::path_match("/", "/w/"));
assert!(!Cookie::path_match("/a", "/w/"));
assert!(!Cookie::path_match("/", "/w"));
assert!(!Cookie::path_match("/w/index.html", "/w/index"));
assert!(!Cookie::path_match("/windex.html", "/w/"));
assert!(!Cookie::path_match("/windex.html", "/w"));
}
#[test]
fn test_default_path() {
assert!(&*Cookie::default_path("/foo/bar/baz/") == "/foo/bar/baz");