diff options
-rw-r--r-- | src/lib.rs | 19 | ||||
-rw-r--r-- | testdata/Alice's Adventures in Wonderland.odt | bin | 0 -> 18472 bytes | |||
-rw-r--r-- | testdata/Alice's Adventures in Wonderland.pdf | bin | 0 -> 23262 bytes |
3 files changed, 19 insertions, 0 deletions
@@ -46,3 +46,22 @@ pub fn get_urls_from_pdf<P: AsRef<Path>>(path: P) -> Result<Vec<String>> { Ok(urls) } + + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn get_urls_from_pdf_extracts_urls_from_pdf() { + let expected = vec![ + "http://www.gutenberg.org/ebooks/11", + "https://ia800908.us.archive.org/6/items/alicesadventures19033gut/19033-h/images/i002.jpg", + "https://science.nasa.gov/news-article/black-hole-image-makes-history", + ]; + + let urls = get_urls_from_pdf("testdata/Alice's Adventures in Wonderland.pdf"); + + assert_eq!(expected, urls.unwrap()); + } +} diff --git a/testdata/Alice's Adventures in Wonderland.odt b/testdata/Alice's Adventures in Wonderland.odt Binary files differnew file mode 100644 index 0000000..09d8469 --- /dev/null +++ b/testdata/Alice's Adventures in Wonderland.odt diff --git a/testdata/Alice's Adventures in Wonderland.pdf b/testdata/Alice's Adventures in Wonderland.pdf Binary files differnew file mode 100644 index 0000000..47c673c --- /dev/null +++ b/testdata/Alice's Adventures in Wonderland.pdf |