-
Notifications
You must be signed in to change notification settings - Fork 2
test: Improve cs parse #2273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Improve cs parse #2273
Conversation
CLose #2195 Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com>
|
Thank you for following naming conventions! 😻 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe pull request refines the CSC/Crl parsing test by updating the static initialization list of expected option identifiers: obsolete entries are removed, new ones are added, and ordering is adjusted to align with the current parser output. File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Their most recently public accepted PR is: #2264 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough在测试类 CSCcrlParseTest 中更新导入与注解,使 parseXpath 测试在 CI 环境中被禁用;并调整初始化时使用的 CCRL 标签到列表,移除/重排若干选项。变更仅限测试代码,无对外 API 变更。 Changes
Sequence Diagram(s)sequenceDiagram
participant CI
participant JUnit
participant TestClass as CSCcrlParseTest
CI->>JUnit: 运行测试 (workEnv=ci)
JUnit->>TestClass: 发现 parseXpath
TestClass-->>JUnit: @DisabledIfSystemProperty(workEnv=ci)
JUnit-->>CI: 跳过 parseXpath
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
PR Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
core/src/test/java/com/tlcsdm/core/util/CSCcrlParseTest.java (1)
83-86: 修复 tag 名中的尾部空格,避免 XPath/DOM 匹配失败
"COptionOsameCode-0 "末尾多了一个空格,将导致//COptionOsameCode-0无法匹配到目标节点。建议修复如下:
- "COptionOaliasAnsi-0", "COptionOsameCode-0 ", "COptionObranchChaining-0", "COptionOalign-0", "COptionGoptimize-0", + "COptionOaliasAnsi-0", "COptionOsameCode-0", "COptionObranchChaining-0", "COptionOalign-0", "COptionGoptimize-0",
🧹 Nitpick comments (2)
core/src/test/java/com/tlcsdm/core/util/CSCcrlParseTest.java (2)
123-126: 用 Collectors.joining 简化 XPath 表达式拼接功能等价,代码更简洁,可读性更好。
- String xpathExpr = Arrays.stream(tagNames) - .map(tag -> "//" + tag) - .reduce((a, b) -> a + " | " + b) - .orElse(""); + String xpathExpr = Arrays.stream(tagNames) + .map(tag -> "//" + tag) + .collect(java.util.stream.Collectors.joining(" | "));如果偏好顶部 import,也可补充:
import java.util.stream.Collectors;并将
java.util.stream.Collectors简化为Collectors。
119-163: 测试仅打印未断言,建议补充最小断言提升有效性当前两个测试主要做解析与打印,失败仅在抛异常时触发。建议至少断言“应能解析到若干已知标签”,避免用例形同“烟雾测试”。
例如在
parseDoc末尾增加“至少解析到一个非空值”的断言(示例):long found = result.values().stream().filter(v -> v != null && !v.isEmpty()).count(); org.junit.jupiter.api.Assertions.assertTrue(found > 0, "应当至少解析到 1 个已知标签值");如果你愿意,我可以基于
util/ccrl.mtpj的实际内容起草更有针对性的断言(如 CPU=RL78、是否包含若干典型 include/library 定义等),并补一组“标签→命令行”映射的测试骨架以呼应 #2195。Also applies to: 165-196
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
core/src/test/java/com/tlcsdm/core/util/CSCcrlParseTest.java(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: build (17, ubuntu-latest, false)
- GitHub Check: build (21, windows-latest, false)
- GitHub Check: build (21, macos-latest, false)
- GitHub Check: build (21, ubuntu-latest, false)
- GitHub Check: build (17, macos-latest, false)
- GitHub Check: build (17, windows-latest, false)
- GitHub Check: qodana
- GitHub Check: StepSecurity Harden-Runner
- GitHub Check: Summary
🔇 Additional comments (5)
core/src/test/java/com/tlcsdm/core/util/CSCcrlParseTest.java (5)
33-33: 在 CI 中按系统属性禁用用例的导入已就绪 — LGTM已引入
DisabledIfSystemProperty,与下方方法级注解配合可避免 CI 假失败。请确保在 CI 流水线中传入
-DworkEnv=ci,例如:
- Maven:
mvn -B -DworkEnv=ci test- 或在 Surefire 配置中加上
<systemPropertyVariables><workEnv>ci</workEnv></systemPropertyVariables>
99-99: 输出控制标签列表调整 — LGTM
HexOptionForm-0与若干LinkOption*的组合在“输出控制”分组内更清晰。
103-104: 链接阶段优化项分组 — LGTM
LinkOptionOptimize*相关项集中于“Optimization”块,定位与维护更直观。
115-115: DSPAsm 标签精简 — LGTM保留
DSPAsmOptionLabel-0与DSPAsmOptionMacroIdentifyExact-0合理,未见问题。
95-97: 已验证新增/重排的 Link 控制标签均存在于 ccrl.mtpj
- 在 core/src/test/resources/util/ccrl.mtpj 中,使用 rg 逐项检查,确认以下标签均已定义:
<LinkOptionDefine-0/><LinkOptionInput-0/><LinkOptionLibrary-0/><LinkOptionBinary-0/><LinkOptionEntry-0>…</LinkOptionEntry-0><LinkOptionEntryPoint-0>…</LinkOptionEntryPoint-0>- 不会出现“未找到”问题,无需进一步修改。



CLose #2195
Fixes #
Proposed Changes
Readiness Checklist
Author/Contributor
Reviewing Maintainer
enhancement,bug,documentationordependenciesSummary by Sourcery
Adjust CSCcrlParseTest expectations by removing obsolete options and adding updated linker options to reflect recent parser support changes
Enhancements:
Summary by CodeRabbit