logo

auto_linker

AutoLinker-shim, based on https://git.pleroma.social/pleroma/auto_linker git clone https://hacktivis.me/git/auto_linker.git
commit: 5573fe6d979735219d03d71beb5a26dddad69a5e
parent 3ce2c34709c650a0315bda0f0683545626badfa3
Author: Mark Felder <feld@FreeBSD.org>
Date:   Thu, 19 Nov 2020 19:30:20 +0000

Test IDN and punycode domains in mentions

Diffstat:

Mtest/linkify_test.exs14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/test/linkify_test.exs b/test/linkify_test.exs @@ -392,6 +392,20 @@ defmodule LinkifyTest do assert Linkify.link(text, mention: true, mention_prefix: "/users/") == text end + + test "IDN domain" do + text = "hello @lain@我爱你.com" + + expected = "hello <a href=\"/users/lain@我爱你.com\">@lain@我爱你.com</a>" + + assert Linkify.link(text, mention: true, mention_prefix: "/users/") == expected + + text = "hello @lain@xn--6qq986b3xl.com" + + expected = "hello <a href=\"/users/lain@xn--6qq986b3xl.com\">@lain@xn--6qq986b3xl.com</a>" + + assert Linkify.link(text, mention: true, mention_prefix: "/users/") == expected + end end describe "hashtag links" do