Fix formatting
This commit is contained in:
parent
2892a0d272
commit
d197823674
2 changed files with 21 additions and 19 deletions
|
|
@ -27,28 +27,27 @@ mod tests {
|
|||
#[test]
|
||||
fn test_empty_text() {
|
||||
let text = "";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert!(links.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_magnet_links() {
|
||||
let text = "This is a text without any magnet links";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert!(links.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_magnet_link() {
|
||||
|
||||
let text = "Here is a magnet link: magnet:?xt=urn:btih:example";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 1);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:example");
|
||||
}
|
||||
|
|
@ -56,9 +55,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_multiple_magnet_links() {
|
||||
let text = "First link: magnet:?xt=urn:btih:example1 and second link: magnet:?xt=urn:btih:example2";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 2);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:example1");
|
||||
assert_eq!(links[1], "magnet:?xt=urn:btih:example2");
|
||||
|
|
@ -67,9 +66,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_magnet_link_at_beginning() {
|
||||
let text = "magnet:?xt=urn:btih:example at the beginning";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 1);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:example");
|
||||
}
|
||||
|
|
@ -77,9 +76,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_magnet_link_at_end() {
|
||||
let text = "Link at the end: magnet:?xt=urn:btih:example";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 1);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:example");
|
||||
}
|
||||
|
|
@ -87,9 +86,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_magnet_link_without_whitespace() {
|
||||
let text = "Text containing a link:magnet:?xt=urn:btih:example";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 1);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:example");
|
||||
}
|
||||
|
|
@ -97,9 +96,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_complex_magnet_link() {
|
||||
let text = "Complex link: magnet:?xt=urn:btih:a1b2c3d4e5f6g7h8i9j0&dn=example+file&tr=udp%3A%2F%2Ftracker.example.com%3A80";
|
||||
|
||||
|
||||
let links = extract_magnet_links(text);
|
||||
|
||||
|
||||
assert_eq!(links.len(), 1);
|
||||
assert_eq!(links[0], "magnet:?xt=urn:btih:a1b2c3d4e5f6g7h8i9j0&dn=example+file&tr=udp%3A%2F%2Ftracker.example.com%3A80");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue