added ー char support
This commit is contained in:
parent
4e9e096a65
commit
d9a1dc84be
2 changed files with 23 additions and 2 deletions
|
@ -12,8 +12,8 @@ namespace BirdsiteLive.Domain.Tools
|
|||
|
||||
public class StatusExtractor : IStatusExtractor
|
||||
{
|
||||
private readonly Regex _hastagRegex = new Regex(@"\W(\#[a-zA-Z0-9_]+\b)(?!;)");
|
||||
private readonly Regex _mentionRegex = new Regex(@"\W(\@[a-zA-Z0-9_]+\b)(?!;)");
|
||||
private readonly Regex _hastagRegex = new Regex(@"\W(\#[a-zA-Z0-9_ー]+\b)(?!;)");
|
||||
private readonly Regex _mentionRegex = new Regex(@"\W(\@[a-zA-Z0-9_ー]+\b)(?!;)");
|
||||
private readonly InstanceSettings _instanceSettings;
|
||||
|
||||
#region Ctor
|
||||
|
|
|
@ -43,6 +43,27 @@ namespace BirdsiteLive.Domain.Tests.Tools
|
|||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Extract_SingleHashTag_SpecialChar_Test()
|
||||
{
|
||||
#region Stubs
|
||||
var message = $"Bla!{Environment.NewLine}#COVIDー19";
|
||||
#endregion
|
||||
|
||||
var service = new StatusExtractor(_settings);
|
||||
var result = service.ExtractTags(message);
|
||||
|
||||
#region Validations
|
||||
Assert.AreEqual(1, result.tags.Length);
|
||||
Assert.AreEqual("#COVIDー19", result.tags.First().name);
|
||||
Assert.AreEqual("Hashtag", result.tags.First().type);
|
||||
Assert.AreEqual("https://domain.name/tags/COVIDー19", result.tags.First().href);
|
||||
|
||||
Assert.IsTrue(result.content.Contains("Bla!"));
|
||||
Assert.IsTrue(result.content.Contains(@"<a href=""https://domain.name/tags/COVIDー19"" class=""mention hashtag"" rel=""tag"">#<span>COVIDー19</span></a>"));
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Extract_MultiHashTags_Test()
|
||||
{
|
||||
|
|
Reference in a new issue