X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParserTest.java;h=fb66f86f71f307b58c2ce5283296f72cf98a3261;hp=8d83c95b8ab52b90fa69eb7193d8984d204efce5;hb=2241b13275a0dec86461aba67db92825424b9f1b;hpb=505c771415cd5c6f71c24e6c2b837d6e2f0c3a78 diff --git a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java index 8d83c95..fb66f86 100644 --- a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java +++ b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java @@ -124,6 +124,22 @@ public class SoneTextParserTest { assertThat("Part Text", "Some text (and a link: [http://example.sone/abc_(def)|example.sone/abc_(def)|example.sone/abc_(def)]) – nice!", is(convertText(parts, PlainTextPart.class, LinkPart.class))); } + @Test + public void punctuationIsIgnoredAtEndOfLinkBeforeWhitespace() { + SoneTextParser soneTextParser = new SoneTextParser(null, null); + Iterable parts = soneTextParser.parse("Some text and a link: http://example.sone/abc. Nice!", null); + assertThat("Parts", parts, notNullValue()); + assertThat("Part Text", "Some text and a link: [http://example.sone/abc|example.sone/abc|example.sone/abc]. Nice!", is(convertText(parts, PlainTextPart.class, LinkPart.class))); + } + + @Test + public void multiplePunctuationCharactersAreIgnoredAtEndOfLinkBeforeWhitespace() { + SoneTextParser soneTextParser = new SoneTextParser(null, null); + Iterable parts = soneTextParser.parse("Some text and a link: http://example.sone/abc... Nice!", null); + assertThat("Parts", parts, notNullValue()); + assertThat("Part Text", "Some text and a link: [http://example.sone/abc|example.sone/abc|example.sone/abc]... Nice!", is(convertText(parts, PlainTextPart.class, LinkPart.class))); + } + /** * Converts all given {@link Part}s into a string, validating that the * part’s classes match only the expected classes.