mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 09:05:45 +00:00
update tests
This commit is contained in:
parent
06fc69cff8
commit
d7166dac66
1 changed files with 33 additions and 15 deletions
|
|
@ -175,34 +175,52 @@ fn test() {
|
||||||
Some("query"),
|
Some("query"),
|
||||||
Some("fragment"),
|
Some("fragment"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let resolve = Redirect::from_str("30 /uri\r\n").unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve.to_uri(&base).unwrap().to_string(),
|
Redirect::from_str("30 /uri\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
"gemini://geminiprotocol.net/uri"
|
"gemini://geminiprotocol.net/uri"
|
||||||
);
|
);
|
||||||
|
|
||||||
let resolve = Redirect::from_str("30 uri\r\n").unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve.to_uri(&base).unwrap().to_string(),
|
Redirect::from_str("30 uri\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
"gemini://geminiprotocol.net/path/uri"
|
"gemini://geminiprotocol.net/path/uri"
|
||||||
);
|
);
|
||||||
|
|
||||||
let resolve = Redirect::from_str("30 gemini://test.host/uri\r\n").unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve.to_uri(&base).unwrap().to_string(),
|
Redirect::from_str("30 gemini://test.host/uri\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
"gemini://test.host/uri"
|
"gemini://test.host/uri"
|
||||||
);
|
);
|
||||||
|
|
||||||
let resolve = Redirect::from_str("30 //\r\n").unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve.to_uri(&base).unwrap().to_string(),
|
Redirect::from_str("30 //\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
"gemini://geminiprotocol.net/"
|
"gemini://geminiprotocol.net/"
|
||||||
);
|
);
|
||||||
|
|
||||||
let resolve = Redirect::from_str("30 //:\r\n").unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve.to_uri(&base).unwrap().to_string(),
|
Redirect::from_str("30 //geminiprotocol.net/path\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
|
"gemini://geminiprotocol.net/path"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
Redirect::from_str("30 //:\r\n")
|
||||||
|
.unwrap()
|
||||||
|
.to_uri(&base)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
"gemini://geminiprotocol.net/"
|
"gemini://geminiprotocol.net/"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue