diff --git a/cmuxTests/AppDelegateShortcutRoutingTests.swift b/cmuxTests/AppDelegateShortcutRoutingTests.swift index 8bc58a59..efb38674 100644 --- a/cmuxTests/AppDelegateShortcutRoutingTests.swift +++ b/cmuxTests/AppDelegateShortcutRoutingTests.swift @@ -6,7 +6,7 @@ import XCTest @testable import cmux #endif -private let lastSurfaceCloseShortcutDefaultsKey = "closeWorkspaceOnLastSurfaceShortcut" +private let appDelegateLastSurfaceCloseShortcutDefaultsKey = "closeWorkspaceOnLastSurfaceShortcut" @MainActor final class AppDelegateShortcutRoutingTests: XCTestCase { @@ -725,13 +725,13 @@ final class AppDelegateShortcutRoutingTests: XCTestCase { } let defaults = UserDefaults.standard - let originalSetting = defaults.object(forKey: lastSurfaceCloseShortcutDefaultsKey) - defaults.set(false, forKey: lastSurfaceCloseShortcutDefaultsKey) + let originalSetting = defaults.object(forKey: appDelegateLastSurfaceCloseShortcutDefaultsKey) + defaults.set(false, forKey: appDelegateLastSurfaceCloseShortcutDefaultsKey) defer { if let originalSetting { - defaults.set(originalSetting, forKey: lastSurfaceCloseShortcutDefaultsKey) + defaults.set(originalSetting, forKey: appDelegateLastSurfaceCloseShortcutDefaultsKey) } else { - defaults.removeObject(forKey: lastSurfaceCloseShortcutDefaultsKey) + defaults.removeObject(forKey: appDelegateLastSurfaceCloseShortcutDefaultsKey) } } diff --git a/cmuxTests/BrowserConfigTests.swift b/cmuxTests/BrowserConfigTests.swift index 487c680c..b60ccef8 100644 --- a/cmuxTests/BrowserConfigTests.swift +++ b/cmuxTests/BrowserConfigTests.swift @@ -2737,43 +2737,6 @@ final class CmuxWebViewDragRoutingTests: XCTestCase { } } -#if compiler(>=6.2) -@available(macOS 26.0, *) -private struct DragConfigurationOperationsSnapshot: Equatable { - let allowCopy: Bool - let allowMove: Bool - let allowDelete: Bool - let allowAlias: Bool -} - -@available(macOS 26.0, *) -private enum DragConfigurationSnapshotError: Error { - case missingBoolField(primary: String, fallback: String?) -} - -@available(macOS 26.0, *) -private func dragConfigurationOperationsSnapshot(from operations: T) throws -> DragConfigurationOperationsSnapshot { - let mirror = Mirror(reflecting: operations) - - func readBool(_ primary: String, fallback: String? = nil) throws -> Bool { - if let value = mirror.descendant(primary) as? Bool { - return value - } - if let fallback, let value = mirror.descendant(fallback) as? Bool { - return value - } - throw DragConfigurationSnapshotError.missingBoolField(primary: primary, fallback: fallback) - } - - return try DragConfigurationOperationsSnapshot( - allowCopy: readBool("allowCopy", fallback: "_allowCopy"), - allowMove: readBool("allowMove", fallback: "_allowMove"), - allowDelete: readBool("allowDelete", fallback: "_allowDelete"), - allowAlias: readBool("allowAlias", fallback: "_allowAlias") - ) -} - - final class BrowserLinkOpenSettingsTests: XCTestCase { private var suiteName: String! private var defaults: UserDefaults! diff --git a/cmuxTests/BrowserPanelTests.swift b/cmuxTests/BrowserPanelTests.swift index 104cecbf..5c61be3d 100644 --- a/cmuxTests/BrowserPanelTests.swift +++ b/cmuxTests/BrowserPanelTests.swift @@ -13,7 +13,7 @@ import UserNotifications @testable import cmux #endif -func drainMainQueue() { +private func drainBrowserPanelMainQueue() { let expectation = XCTestExpectation(description: "drain main queue") DispatchQueue.main.async { expectation.fulfill() @@ -22,7 +22,7 @@ func drainMainQueue() { } @MainActor -func makeTemporaryBrowserProfile(named prefix: String) throws -> BrowserProfileDefinition { +private func makeTemporaryBrowserPanelProfile(named prefix: String) throws -> BrowserProfileDefinition { try XCTUnwrap( BrowserProfileStore.shared.createProfile( named: "\(prefix)-\(UUID().uuidString)" @@ -107,7 +107,7 @@ final class BrowserPanelOmnibarPillBackgroundColorTests: XCTestCase { @MainActor final class BrowserPanelProfileIsolationTests: XCTestCase { func testStaleDidFinishDoesNotRecordVisitIntoSwitchedProfileHistory() throws { - let alternateProfile = try makeTemporaryBrowserProfile(named: "Switched") + let alternateProfile = try makeTemporaryBrowserPanelProfile(named: "Switched") let defaultStore = BrowserHistoryStore.shared let alternateStore = BrowserProfileStore.shared.historyStore(for: alternateProfile.id) defaultStore.clearHistory() @@ -137,7 +137,7 @@ final class BrowserPanelProfileIsolationTests: XCTestCase { alternateStore.clearHistory() staleDelegate.webView?(staleWebView, didFinish: nil) - drainMainQueue() + drainBrowserPanelMainQueue() XCTAssertTrue( defaultStore.entries.isEmpty, diff --git a/cmuxTests/WindowAndDragTests.swift b/cmuxTests/WindowAndDragTests.swift index e618949f..6964c45f 100644 --- a/cmuxTests/WindowAndDragTests.swift +++ b/cmuxTests/WindowAndDragTests.swift @@ -299,6 +299,42 @@ final class FocusFlashPatternTests: XCTestCase { } +@available(macOS 26.0, *) +private struct DragConfigurationOperationsSnapshot: Equatable { + let allowCopy: Bool + let allowMove: Bool + let allowDelete: Bool + let allowAlias: Bool +} + +@available(macOS 26.0, *) +private enum DragConfigurationSnapshotError: Error { + case missingBoolField(primary: String, fallback: String?) +} + +@available(macOS 26.0, *) +private func dragConfigurationOperationsSnapshot(from operations: T) throws -> DragConfigurationOperationsSnapshot { + let mirror = Mirror(reflecting: operations) + + func readBool(_ primary: String, fallback: String? = nil) throws -> Bool { + if let value = mirror.descendant(primary) as? Bool { + return value + } + if let fallback, let value = mirror.descendant(fallback) as? Bool { + return value + } + throw DragConfigurationSnapshotError.missingBoolField(primary: primary, fallback: fallback) + } + + return try DragConfigurationOperationsSnapshot( + allowCopy: readBool("allowCopy", fallback: "_allowCopy"), + allowMove: readBool("allowMove", fallback: "_allowMove"), + allowDelete: readBool("allowDelete", fallback: "_allowDelete"), + allowAlias: readBool("allowAlias", fallback: "_allowAlias") + ) +} + +#if compiler(>=6.2) @MainActor final class InternalTabDragConfigurationTests: XCTestCase { func testDisablesExternalOperationsForInternalTabDrags() throws { @@ -1080,3 +1116,4 @@ final class MarkdownPanelPointerObserverViewTests: XCTestCase { XCTAssertNil(overlay.hitTest(NSPoint(x: 40, y: 30))) } } +#endif diff --git a/cmuxTests/WorkspaceManualUnreadTests.swift b/cmuxTests/WorkspaceManualUnreadTests.swift index 1610dc34..6fbe30c3 100644 --- a/cmuxTests/WorkspaceManualUnreadTests.swift +++ b/cmuxTests/WorkspaceManualUnreadTests.swift @@ -7,6 +7,7 @@ import AppKit @testable import cmux #endif +@MainActor final class WorkspaceManualUnreadTests: XCTestCase { func testShouldClearManualUnreadWhenFocusMovesToDifferentPanel() { let previousFocusedPanelId = UUID() @@ -281,7 +282,7 @@ final class CommandPaletteSwitcherSearchIndexerTests: XCTestCase { XCTAssertFalse(keywords.contains("cmd-palette-indexing")) } - func testSurfaceDetailOutranksWorkspaceDetailForPathToken() { + func testSurfaceDetailOutranksWorkspaceDetailForPathToken() throws { let metadata = CommandPaletteSwitcherSearchMetadata( directories: ["/tmp/worktrees/cmux"], branches: ["feature/cmd-palette"], diff --git a/cmuxTests/WorkspaceUnitTests.swift b/cmuxTests/WorkspaceUnitTests.swift index 5bd83682..719baa43 100644 --- a/cmuxTests/WorkspaceUnitTests.swift +++ b/cmuxTests/WorkspaceUnitTests.swift @@ -1896,4 +1896,3 @@ final class SidebarWorkspaceShortcutHintMetricsTests: XCTestCase { XCTAssertGreaterThan(widened, base) } } -#endif