Skip to content

Commit

Permalink
messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hlaueriksson committed Aug 4, 2024
1 parent 85b1c3b commit 1ec7891
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
7 changes: 0 additions & 7 deletions samples/GEmojiSharp.Sample.Web/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ public class ErrorModel : PageModel

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Expand Down
4 changes: 2 additions & 2 deletions src/GEmojiSharp/Emoji.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace GEmojiSharp
/// </summary>
public static partial class Emoji
{
private static readonly Dictionary<string, GEmoji> AliasToGEmoji = new();
private static readonly Dictionary<string, GEmoji> RawToGEmoji = new();
private static readonly Dictionary<string, GEmoji> AliasToGEmoji = [];
private static readonly Dictionary<string, GEmoji> RawToGEmoji = [];

static Emoji()
{
Expand Down
6 changes: 3 additions & 3 deletions src/GEmojiSharp/EmojiExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ public static class EmojiExtensions
{
private const char Colon = ':';

private static readonly string[] SkinTones = new[]
{
private static readonly string[] SkinTones =
[
"🏻", // light skin tone
"🏼", // medium-light skin tone
"🏽", // medium skin tone
"🏾", // medium-dark skin tone
"🏿", // dark skin tone
};
];

/// <summary>
/// Gets the emoji associated with the alias, or <see cref="GEmoji.Empty"/> if the alias is not found.
Expand Down
2 changes: 1 addition & 1 deletion src/GEmojiSharp/GEmoji.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GEmoji
public string? Category { get; set; }

/// <summary>A list of names uniquely referring to the emoji.</summary>
public string[] Aliases { get; set; } = System.Array.Empty<string>();
public string[] Aliases { get; set; } = [];

/// <summary>A list of tags associated with the emoji. Multiple emojis can share the same tags.</summary>
public string[]? Tags { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ProcessAsync()

TagHelperOutput GetTagHelperOutput(string content)
{
return new TagHelperOutput("body", new TagHelperAttributeList(), (flag, encoder) =>
return new TagHelperOutput("body", [], (flag, encoder) =>
{
var tagHelperContent = new DefaultTagHelperContent();
tagHelperContent.SetContent(content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ProcessAsync()

TagHelperOutput GetTagHelperOutput(string content)
{
return new TagHelperOutput("emoji", new TagHelperAttributeList(), (flag, encoder) =>
return new TagHelperOutput("emoji", [], (flag, encoder) =>
{
var tagHelperContent = new DefaultTagHelperContent();
tagHelperContent.SetContent(content);
Expand Down
4 changes: 2 additions & 2 deletions tests/GEmojiSharp.Tests/EmojiExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public void Alias()
[Test]
public void RawSkinToneVariants()
{
"✌️".GetEmoji().RawSkinToneVariants().Should().BeEquivalentTo(new[] { "✌🏻", "✌🏼", "✌🏽", "✌🏾", "✌🏿" });
"🧔‍♀️".GetEmoji().RawSkinToneVariants().Should().BeEquivalentTo(new[] { "🧔🏻‍♀", "🧔🏼‍♀", "🧔🏽‍♀", "🧔🏾‍♀", "🧔🏿‍♀" });
"✌️".GetEmoji().RawSkinToneVariants().Should().BeEquivalentTo(["✌🏻", "✌🏼", "✌🏽", "✌🏾", "✌🏿"]);
"🧔‍♀️".GetEmoji().RawSkinToneVariants().Should().BeEquivalentTo(["🧔🏻‍♀", "🧔🏼‍♀", "🧔🏽‍♀", "🧔🏾‍♀", "🧔🏿‍♀"]);
":atom:".GetEmoji().RawSkinToneVariants().Should().BeEmpty();
GEmoji.Empty.RawSkinToneVariants().Should().BeEmpty();
NullGEmoji.RawSkinToneVariants().Should().BeEmpty();
Expand Down
6 changes: 3 additions & 3 deletions tests/GEmojiSharp.Tests/GenerateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public void Generate_RegexPattern()

foreach (var code in codes.OrderByDescending(x => x.Length))
{
if (result.Length > 0) result.Append("|");
if (result.Length > 0) result.Append('|');
result.Append(code);
}
result.Insert(0, "(");
result.Append(")");
result.Insert(0, '(');
result.Append(')');

var path = Directory.GetCurrentDirectory() + @"..\..\..\..\..\..\src\GEmojiSharp\Emoji.g.RegexPattern.cs";
var contents = File.ReadAllLines(path);
Expand Down

0 comments on commit 1ec7891

Please sign in to comment.