Browse Source

Add ansi parser tests

pull/55/head
Ionite 1 year ago
parent
commit
9019d4843e
No known key found for this signature in database
  1. 19
      StabilityMatrix.Tests/Core/AnsiParserTests.cs

19
StabilityMatrix.Tests/Core/AnsiParserTests.cs

@ -0,0 +1,19 @@
using StabilityMatrix.Core.Processes;
namespace StabilityMatrix.Tests.Core;
[TestClass]
public class AnsiParserTests
{
[DataTestMethod]
[DataRow("\u001b[0m", "\u001b[0m")]
[DataRow("\u001b[A", "\u001b[A")]
[DataRow("\u001b[A\r\n", "\u001b[A")]
public void TestAnsiRegex(string source, string expectedMatch)
{
var pattern = AnsiParser.AnsiEscapeSequenceRegex();
var match = pattern.Match(source);
Assert.IsTrue(match.Success);
Assert.AreEqual(expectedMatch, match.Value);
}
}
Loading…
Cancel
Save