From f8882f0d05751267b6fd1f2d5035d79337d72685 Mon Sep 17 00:00:00 2001 From: FxRayHughes <25192142+FxRayHughes@users.noreply.github.com> Date: Sun, 1 Nov 2026 17:01:48 +0800 Subject: [PATCH] =?UTF-8?q?test(macos):=20=E8=AE=BE=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E5=A3=B0=E6=98=8E=E9=A1=BA=E5=BA=8F=E4=B8=8E=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=20(#1581?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 运行环境、环境来源两页插在项目页和运行配置之间,使 SettingsCategory 声明顺序(搜索结果顺序)与侧栏构建分组顺序不一致, settingsCategoryPlacesProjectAndRunBetweenKeymapAndTerminal 在 CI 失败。 把两页的 case 移到项目页之前,测试改为断言 Keymap 与 Terminal 之间 恰好是构建分组,且分组以项目页、运行配置结尾。 --- .../AppModel/AppModelSupportTypes.swift | 2 +- .../ProjectRuntimeSettingsTests.swift | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/macos/Sources/Lithe/Models/AppModel/AppModelSupportTypes.swift b/macos/Sources/Lithe/Models/AppModel/AppModelSupportTypes.swift index a77ba90d64..637c7fd9fc 100644 --- a/macos/Sources/Lithe/Models/AppModel/AppModelSupportTypes.swift +++ b/macos/Sources/Lithe/Models/AppModel/AppModelSupportTypes.swift @@ -6,9 +6,9 @@ enum SettingsCategory: String, CaseIterable, Identifiable { case general = "General" case editor = "Editor" case keymap = "Keymap" - case project = "Project" case toolchainEnvironment = "Runtime Environment" case toolchainSources = "Toolchain Sources" + case project = "Project" case run = "Run configurations" case terminal = "Terminal" case lsp = "LSP" diff --git a/macos/Tests/LitheTests/ProjectRuntimeSettingsTests.swift b/macos/Tests/LitheTests/ProjectRuntimeSettingsTests.swift index 0da308e7a5..02d0fc93d9 100644 --- a/macos/Tests/LitheTests/ProjectRuntimeSettingsTests.swift +++ b/macos/Tests/LitheTests/ProjectRuntimeSettingsTests.swift @@ -139,17 +139,19 @@ struct ProjectRuntimeSettingsTests { } @Test - func settingsCategoryPlacesProjectAndRunBetweenKeymapAndTerminal() { - // Run configurations sit next to the project environment they inherit. - let titles = SettingsCategory.allCases.map(\.rawValue) - let keymap = titles.firstIndex(of: "Keymap") - let project = titles.firstIndex(of: "Project") - let run = titles.firstIndex(of: "Run configurations") - let terminal = titles.firstIndex(of: "Terminal") - #expect(keymap != nil && project != nil && run != nil && terminal != nil) - #expect(project == keymap.map { $0 + 1 }) - #expect(run == project.map { $0 + 1 }) - #expect(terminal == run.map { $0 + 1 }) + func settingsCategoryPlacesBuildPagesBetweenKeymapAndTerminal() { + // The build group (toolchain pages, project environment, run configurations) + // stays contiguous in declaration order, so search results list the pages in + // the same order as the sidebar and run configurations still follow the + // project environment they inherit. + let cases = SettingsCategory.allCases + guard let keymap = cases.firstIndex(of: .keymap), + let terminal = cases.firstIndex(of: .terminal) else { + Issue.record("Keymap and Terminal must both be settings pages") + return + } + #expect(Array(cases[(keymap + 1)..