aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2a59906..c7f6e94 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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());
+ }
+}