summaryrefslogtreecommitdiffstats
path: root/libimagentrymarkdown/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-05-29 11:18:29 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-06-09 16:52:34 +0200
commit650e29d4b5a805b83e30c530c740ade21d7d8542 (patch)
treed2128b915e5562bfe99ed14e5eac3a2f2b28f4cf /libimagentrymarkdown/src
parent1bb961ecb3a4de61e4d747e9fcd1b16e6ec77698 (diff)
Add test: Two nonsimilar links
Diffstat (limited to 'libimagentrymarkdown/src')
-rw-r--r--libimagentrymarkdown/src/link.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/libimagentrymarkdown/src/link.rs b/libimagentrymarkdown/src/link.rs
index 4c955fa5..19914308 100644
--- a/libimagentrymarkdown/src/link.rs
+++ b/libimagentrymarkdown/src/link.rs
@@ -95,5 +95,28 @@ Some more [example text](http://example.com).
assert_eq!(exp, links.pop().unwrap());
}
+ #[test]
+ fn test_two_links() {
+ let testtext = r#"
+Some [example text](http://example.com).
+Some more [foo](http://example.com/foo).
+ "#;
+
+ let exp1 = Link {
+ title: String::from("example text"),
+ link: String::from("http://example.com"),
+ };
+
+ let exp2 = Link {
+ title: String::from("foo"),
+ link: String::from("http://example.com/foo"),
+ };
+
+ let mut links = extract_links(&testtext[..]);
+ assert_eq!(2, links.len());
+ assert_eq!(exp2, links.pop().unwrap());
+ assert_eq!(exp1, links.pop().unwrap());
+ }
+
}