refactor: split node agent and Go control plane
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using WxAgent.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace WxAgent.Core.Tests;
|
||||
|
||||
public sealed class WechatTextInputTests
|
||||
{
|
||||
[Fact]
|
||||
public void PreservesMultilineWhitespaceWithCanonicalLineEndings()
|
||||
{
|
||||
Assert.Equal("first\n\n second\t\nthird", WechatTextInput.Prepare("first\r\n\r\n second\t\rthird"));
|
||||
Assert.Equal(new string('x', 4000), WechatTextInput.Prepare(new string('x', 4000)));
|
||||
Assert.Throws<WxAgentException>(() => WechatTextInput.Prepare(new string('x', 4001)));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData(" \r\n\t")]
|
||||
[InlineData("before\0after")]
|
||||
[InlineData("before\u001bafter")]
|
||||
public void RejectsEmptyOrUnsafeInput(string input) =>
|
||||
Assert.Throws<WxAgentException>(() => WechatTextInput.Prepare(input));
|
||||
|
||||
[Fact]
|
||||
public void QuoteParserPreservesBlankLinesAndIndentation()
|
||||
{
|
||||
const string reply = "first\n\n second ";
|
||||
var parsed = Assert.Single(VisibleMessageParser.Parse([reply + "\n引用 Alice 的消息 : original"]));
|
||||
Assert.Equal(reply, parsed.Text);
|
||||
Assert.Equal(ChatMessageType.Quote, parsed.Type);
|
||||
Assert.True(WechatSendConfirmation.Matches(parsed, new HashSet<string>(), ChatMessageType.Quote, reply));
|
||||
Assert.Equal("original", parsed.Quote!.Text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user