From 1bb961ecb3a4de61e4d747e9fcd1b16e6ec77698 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 29 May 2016 11:16:55 +0200 Subject: [PATCH] Add test: Two (similar) links --- libimagentrymarkdown/src/link.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libimagentrymarkdown/src/link.rs b/libimagentrymarkdown/src/link.rs index 41912f64..4c955fa5 100644 --- a/libimagentrymarkdown/src/link.rs +++ b/libimagentrymarkdown/src/link.rs @@ -77,5 +77,23 @@ mod test { assert_eq!(exp, links.pop().unwrap()) } + #[test] + fn test_two_similar_links() { + let testtext = r#" +Some [example text](http://example.com). +Some more [example text](http://example.com). + "#; + + let exp = Link { + title: String::from("example text"), + link: String::from("http://example.com"), + }; + + let mut links = extract_links(&testtext[..]); + assert_eq!(2, links.len()); + assert_eq!(exp, links.pop().unwrap()); + assert_eq!(exp, links.pop().unwrap()); + } + }