X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParserTest.kt;h=bd1485834a444b4db80722a533cf2db413850ce8;hb=fa16c5b20a92c8ee7489b612e384dd2a28ee6137;hp=b20225a16ba7c07eac7ae9e26c4fce6659c85849;hpb=03cec6a6772c2d836d94864adddaf544cbe9d72f;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/text/SoneTextParserTest.kt b/src/test/kotlin/net/pterodactylus/sone/text/SoneTextParserTest.kt index b20225a..bd14858 100644 --- a/src/test/kotlin/net/pterodactylus/sone/text/SoneTextParserTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/text/SoneTextParserTest.kt @@ -1,5 +1,5 @@ /* - * Sone - SoneTextParserTest.kt - Copyright © 2011–2019 David Roden + * Sone - SoneTextParserTest.kt - Copyright © 2011–2020 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ package net.pterodactylus.sone.text import com.google.inject.Guice.* +import freenet.keys.FreenetURI import net.pterodactylus.sone.data.* import net.pterodactylus.sone.data.impl.* import net.pterodactylus.sone.database.* @@ -251,6 +252,14 @@ class SoneTextParserTest { } @Test + fun `broken usk links is parsed as plain text`() { + val context = SoneTextParserContext(IdOnlySone("qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU")) + val parts = soneTextParser.parse("USK@/someCrazyName.R1/0", context) + FreenetURI("USK@/someCrazyName.R1/0") + assertThat("Part Text", convertText(parts), equalTo("USK@/someCrazyName.R1/0")) + } + + @Test fun `test basic ksk links`() { val parts: Iterable = soneTextParser.parse("KSK@gpl.txt", null) assertThat("Part Text", convertText(parts, FreenetLinkPart::class.java), equalTo("[KSK@gpl.txt|KSK@gpl.txt|gpl.txt]"))