mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 09:05:45 +00:00
implement titan test
This commit is contained in:
parent
df191c8e25
commit
ac53f73a60
1 changed files with 27 additions and 1 deletions
|
|
@ -9,10 +9,36 @@ fn client_connection_request_gemini() {
|
|||
assert_eq!(
|
||||
&match Request::gemini(Uri::parse(REQUEST, UriFlags::NONE).unwrap()) {
|
||||
Request::Gemini(request) => request.uri.to_string(),
|
||||
Request::Titan(_) => panic!(),
|
||||
_ => panic!(),
|
||||
},
|
||||
REQUEST
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn client_connection_request_titan() {
|
||||
const DATA: &[u8] = &[1, 2, 3];
|
||||
const MIME: &str = "plain/text";
|
||||
const TOKEN: &str = "token";
|
||||
const ARGUMENT: &str = "argument";
|
||||
const REQUEST: &str = "titan://geminiprotocol.net/raw/Test";
|
||||
assert_eq!(
|
||||
std::str::from_utf8(
|
||||
&Request::titan(
|
||||
Uri::parse(&format!("{REQUEST}?arg={ARGUMENT}"), UriFlags::NONE).unwrap(),
|
||||
DATA.to_vec(),
|
||||
Some(MIME.to_string()),
|
||||
Some(TOKEN.to_string()),
|
||||
)
|
||||
.to_bytes()
|
||||
)
|
||||
.unwrap(),
|
||||
format!(
|
||||
"{REQUEST};size={};mime={MIME};token={TOKEN}?arg={ARGUMENT}\r\n{}",
|
||||
DATA.len(),
|
||||
std::str::from_utf8(DATA).unwrap(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// @TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue