Skip to content

test(macos): 设置页声明顺序与构建分组保持一致(修复 #1581 的 macOS CI) - #1

Merged
FxRayHughes merged 1 commit into
feat/plugin-toolchain-sourcesfrom
fix/1581-settings-order
Nov 1, 2026
Merged

FxRayHughes merged 1 commit into
feat/plugin-toolchain-sourcesfrom
fix/1581-settings-order

Conversation

@FxRayHughes

Copy link
Copy Markdown
Owner

关联

合并目标是 1lck/Lithe-IDEA#1581 的分支 feat/plugin-toolchain-sources。合并后 1lck#1581 会自动包含这次改动。

这个 PR 做什么

修复 1lck#1581 在 head 06337dc6 上 macOS CI 唯一的失败(Swift tests):

✘ settingsCategoryPlacesProjectAndRunBetweenKeymapAndTerminal()
  ProjectRuntimeSettingsTests.swift:151: (run → 6) == (project.map { $0 + 1 } → 4)

原因:1lck#1581 把 toolchainEnvironment、toolchainSources 两个 case 插在 SettingsCategory 的 project 和 run 之间,而侧栏 SettingsGroup.build 的顺序是「运行环境 → 环境来源 → 项目 → 运行配置」。SettingsCategory.allCases 的声明顺序就是设置搜索结果的顺序(SettingsView.filteredCategories),所以搜索时这几页的顺序会和侧栏不一样,旧测试也因此失败。

改动

文件 改动
macos/Sources/Lithe/Models/AppModel/AppModelSupportTypes.swift 两个工具链 case 移到 project 之前,声明顺序和侧栏构建分组一致。只调整顺序,rawValue 和图标都不变
macos/Tests/LitheTests/ProjectRuntimeSettingsTests.swift 测试改名为 settingsCategoryPlacesBuildPagesBetweenKeymapAndTerminal,断言 Keymap 和 Terminal 之间正好是 SettingsGroup.build.categories,并且最后两项是项目页、运行配置(保留原测试「运行配置紧跟它继承的项目环境」的意图)

验证(本地)

  • test-stability-macos.sh -- --build-system native --filter 'ProjectRuntimeSettingsTests|SettingsSidebar|SettingsSearchVocabulary|MacToolchainDiscoveryTests|ToolchainSettings|MacLoginShellEnvironmentTests':74 个测试、8 个 suite 全部通过,用时 3.6 秒,没有单个测试超过 1 秒。脚本附带的 test stability、i18n --check、runtime bundle immutability 检查也都通过。
  • cargo test -p lithe-core --lib toolchain:71 个通过,0 个失败。其中包括评审机器人两个 P2 的回归测试(符号链接安装从解码到解析的完整链路、环境候选按声明的 path 布局选择)。
  • 未执行:macOS 全量测试、Windows。

运行环境、环境来源两页插在项目页和运行配置之间,使 SettingsCategory
声明顺序(搜索结果顺序)与侧栏构建分组顺序不一致,
settingsCategoryPlacesProjectAndRunBetweenKeymapAndTerminal 在 CI 失败。
把两页的 case 移到项目页之前,测试改为断言 Keymap 与 Terminal 之间
恰好是构建分组,且分组以项目页、运行配置结尾。
@FxRayHughes
FxRayHughes marked this pull request as ready for review November 1, 2026 09:20
@FxRayHughes
FxRayHughes merged commit 6278663 into feat/plugin-toolchain-sources Nov 1, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant