2020-03-23 03:08:41 +01:00
|
|
|
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
|
|
|
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
|
|
|
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
|
|
|
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
|
|
|
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
|
|
|
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
|
2020-05-23 09:49:04 +02:00
|
|
|
#[cfg(test)]
|
|
|
|
mod passing {
|
2020-06-24 09:16:40 +02:00
|
|
|
use crate::url;
|
2020-03-23 03:08:41 +01:00
|
|
|
|
2020-05-23 09:49:04 +02:00
|
|
|
#[test]
|
|
|
|
fn removes_fragment() {
|
|
|
|
assert_eq!(
|
2020-06-24 09:16:40 +02:00
|
|
|
url::clean_url("https://somewhere.com/font.eot#iefix"),
|
2020-05-23 09:49:04 +02:00
|
|
|
"https://somewhere.com/font.eot"
|
|
|
|
);
|
|
|
|
}
|
2020-03-23 03:08:41 +01:00
|
|
|
|
2020-05-23 09:49:04 +02:00
|
|
|
#[test]
|
|
|
|
fn removes_empty_fragment() {
|
|
|
|
assert_eq!(
|
2020-06-24 09:16:40 +02:00
|
|
|
url::clean_url("https://somewhere.com/font.eot#"),
|
2020-05-23 09:49:04 +02:00
|
|
|
"https://somewhere.com/font.eot"
|
|
|
|
);
|
|
|
|
}
|
2020-04-11 02:43:29 +02:00
|
|
|
|
2020-05-23 09:49:04 +02:00
|
|
|
#[test]
|
|
|
|
fn removes_empty_query_and_empty_fragment() {
|
|
|
|
assert_eq!(
|
2020-06-24 09:16:40 +02:00
|
|
|
url::clean_url("https://somewhere.com/font.eot?#"),
|
2020-05-23 09:49:04 +02:00
|
|
|
"https://somewhere.com/font.eot"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn removes_empty_query_amp_and_empty_fragment() {
|
|
|
|
assert_eq!(
|
2020-06-24 09:16:40 +02:00
|
|
|
url::clean_url("https://somewhere.com/font.eot?a=b&#"),
|
2020-05-23 09:49:04 +02:00
|
|
|
"https://somewhere.com/font.eot?a=b"
|
|
|
|
);
|
|
|
|
}
|
2020-04-26 02:59:34 +02:00
|
|
|
|
2020-05-23 09:49:04 +02:00
|
|
|
#[test]
|
|
|
|
fn keeps_credentials() {
|
|
|
|
assert_eq!(
|
2020-06-24 09:16:40 +02:00
|
|
|
url::clean_url("https://cookie:monster@gibson.internet/"),
|
2020-05-23 09:49:04 +02:00
|
|
|
"https://cookie:monster@gibson.internet/"
|
|
|
|
);
|
|
|
|
}
|
2020-04-26 02:59:34 +02:00
|
|
|
}
|