Skip to content

tests: 添加 xUnit 单元测试和工作流 - #37

Merged
DuckDuckStudio merged 2 commits into
mainfrom
tests
Oct 16, 2026
Merged

DuckDuckStudio merged 2 commits into
mainfrom
tests

Conversation

@DuckDuckStudio

Copy link
Copy Markdown
Owner

No description provided.

@DuckDuckStudio DuckDuckStudio added DEV-开发分支合并 开发分支的合并PR tests 测试相关修改 labels Oct 16, 2026
@DuckDuckStudio
DuckDuckStudio marked this pull request as draft October 16, 2026 09:15
@DuckDuckStudio
DuckDuckStudio force-pushed the tests branch 5 times, most recently from 6684f3a to 7361a29 Compare October 16, 2026 17:23
@DuckDuckStudio
DuckDuckStudio marked this pull request as ready for review October 16, 2026 17:34
@DuckDuckStudio

DuckDuckStudio commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner Author

预期有三个测试失败:

> dotnet test src/
正在从以下位置运行测试 src\PinAction.tests\bin\Debug\net10.0\PinAction.tests.dll (net10.0|x64)
失败 PinActionHash 方法应正确固定引用并保留内联注释 (516ms)
  从 src\PinAction.tests\bin\Debug\net10.0\PinAction.tests.dll (net10.0|x64)
  Assert.Equal() Failure: Collections differ at index 1
                                         ↓ (pos 68)
  Expected: ···"456789abcdef01234567     # v1.2.0 keep this commen"···
  Actual:   ···"456789abcdef01234567      # v1.2.0 keep this comme"···
                                         ↑ (pos 68)
    在 PinAction.Tests.UnitTests.PinActionHash_PinsReferencesAndPreservesInlineComments() 位于 src\PinAction.tests\UnitTests.cs:146
    在 System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
    在 System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
失败 PinActionHash 方法应将附注标签对象解析为其目标提交哈希 (13ms)
  从 src\PinAction.tests\bin\Debug\net10.0\PinAction.tests.dll (net10.0|x64)
  Assert.Equal() Failure: Strings differ
                                    ↓ (pos 23)
  Expected: "      uses: owner/repo@0123456789abcdef0123456789a"···
  Actual:   "      uses: owner/repo@aaaaaaaaaaaaaaaaaaaaaaaaaaa"···
                                    ↑ (pos 23)
    在 PinAction.Tests.UnitTests.PinActionHash_ResolvesAnnotatedTagToCommitHash() 位于 src\PinAction.tests\UnitTests.cs:175
    在 System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
    在 System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
失败 PinActionHash 方法应跳过最终目标不是提交的附注标签 (17ms)
  从 src\PinAction.tests\bin\Debug\net10.0\PinAction.tests.dll (net10.0|x64)
  Assert.Equal() Failure: Strings differ
                                    ↓ (pos 23)
  Expected: "      uses: owner/repo@v1"
  Actual:   "      uses: owner/repo@aaaaaaaaaaaaaaaaaaaaaaaaaaa"···
                                    ↑ (pos 23)
    在 PinAction.Tests.UnitTests.PinActionHash_SkipsAnnotatedTagWhenResolvedTargetIsNotCommit() 位于 src\PinAction.tests\UnitTests.cs:197
    在 System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
    在 System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
src\PinAction.tests\bin\Debug\net10.0\PinAction.tests.dll (net10.0|x64) 失败并出现 3 个错误 (1s 464ms)
退出代码: 2

测试运行摘要: 失败!
  总计: 7
  失败: 3
  成功: 4
  已跳过: 0
  持续时间: 2s 029ms
已完成测试运行,但显示非成功退出代码: 2 (请参阅: https://aka.ms/testingplatform/exitcodes)

对应议题 #38 #34 。

@DuckDuckStudio DuckDuckStudio added workflow 工作流相关修改 tests/passed 测试通过 labels Oct 16, 2026
@DuckDuckStudio DuckDuckStudio self-assigned this Oct 16, 2026
@DuckDuckStudio
DuckDuckStudio merged commit b2e4f57 into main Oct 16, 2026
6 of 9 checks passed
@DuckDuckStudio
DuckDuckStudio deleted the tests branch October 16, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV-开发分支合并 开发分支的合并PR tests/passed 测试通过 tests 测试相关修改 workflow 工作流相关修改

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant