Improved handling for URLs that are composed of mixed character sets.

This commit is contained in:
Greyson Parrelli
2019-02-20 17:00:23 -08:00
parent 9d21c36ddf
commit b2d4608cdb
4 changed files with 149 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
package org.thoughtcrime.securesms.linkpreview;
import org.junit.Test;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
public class LinkPreviewUtilTest {
@Test
public void isLegal_allLatin() {
assertTrue(LinkPreviewUtil.isLegalUrl("https://signal.org"));
}
@Test
public void isLegal_latinAndCyrillic() {
assertFalse(LinkPreviewUtil.isLegalUrl("https://www.аmazon.com"));
}
@Test
public void isLegal_latinAndGreek() {
assertFalse(LinkPreviewUtil.isLegalUrl("https://www.αpple.com"));
}
}