test: 修复检测工具的一处边界问题

This commit is contained in:
Fu Diwei
2021-08-16 15:25:06 +08:00
parent 5522bb49b7
commit 0076cacb0c
6 changed files with 25 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace SKIT.FlurlHttpClient.Wechat
{
public static class TestAssertUtil
public static class CodeStyleUtil
{
private static bool TryJsonize(string json, Type type, out Exception exception)
{
@@ -400,8 +400,8 @@ namespace SKIT.FlurlHttpClient.Wechat
{
for (int urlSegmentIndex = 0; urlSegmentIndex < expectedUrlSegments.Length; urlSegmentIndex++)
{
string expectedUrlSegment = expectedUrlSegments[urlSegmentIndex];
string actualUrlSegment = actualUrlSegments[urlSegmentIndex];
string expectedUrlSegment = expectedUrlSegments[urlSegmentIndex].Trim('/');
string actualUrlSegment = actualUrlSegments[urlSegmentIndex].Trim('/');
if (expectedUrlSegment.Contains("{"))
{
if (actualUrlSegment.StartsWith("\""))
@@ -412,7 +412,7 @@ namespace SKIT.FlurlHttpClient.Wechat
}
else
{
actualUrlSegment = actualUrlSegment.Replace("\"", string.Empty);
actualUrlSegment = actualUrlSegment.Replace("\"", string.Empty).Trim('/');
if (!string.Equals(expectedUrlSegment, actualUrlSegment))
{
lstError.Add(new Exception($"源代码 \"{extCodeFileName}\" 下第 {i + 1} 段文档注释有误,`[{expectedMethod}] {expectedUrl}` 与实际接口路由不一致。"));