mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-01-10 04:40:25 +00:00
28 lines
845 B
C#
28 lines
845 B
C#
using CompatBot.Utils;
|
|
using NUnit.Framework;
|
|
|
|
namespace Tests
|
|
{
|
|
[TestFixture]
|
|
public class StringUtilTests
|
|
{
|
|
[Test]
|
|
public void VisibleLengthTest()
|
|
{
|
|
Assert.That("🇭🇷".GetVisibleLength(), Is.EqualTo(2));
|
|
Assert.That("\u200d".GetVisibleLength(), Is.EqualTo(0));
|
|
Assert.That("㌀".GetVisibleLength(), Is.EqualTo(1));
|
|
Assert.That("a\u0304\u0308bc\u0327".GetVisibleLength(), Is.EqualTo(3));
|
|
Assert.That("Megamouse".GetVisibleLength(), Is.EqualTo(9));
|
|
}
|
|
|
|
[Test]
|
|
public void VisibleTrimTest()
|
|
{
|
|
Assert.That("abc".TrimVisible(100), Is.EqualTo("abc"));
|
|
Assert.That("abc".TrimVisible(3), Is.EqualTo("abc"));
|
|
Assert.That("abc".TrimVisible(2), Is.EqualTo("a…"));
|
|
}
|
|
}
|
|
}
|