Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cmuxTests/WindowAndDragTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,32 @@ final class AppDelegateWindowContextRoutingTests: XCTestCase {
}


/// `AppDelegate.init` installs the new delegate as `AppDelegate.shared`, and
/// many tests build a throwaway one without putting the host's back. The next
/// test in the same host then ran against the leftover: detached-inspector
/// Cmd-W tests failed on main whenever the shard layout placed them after
/// AppDelegateWindowContextRoutingTests. XCTest runs these two in name order.
@MainActor
final class AppDelegateSharedIsolationTests: XCTestCase {
private static var sharedBeforeLeak: AppDelegate??
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

func test1ConstructingAnAppDelegateReplacesShared() {
Self.sharedBeforeLeak = .some(AppDelegate.shared)
let leaked = AppDelegate()
XCTAssertTrue(AppDelegate.shared === leaked)
}

func test2NextTestStartsWithTheHostSharedDelegate() throws {
guard let expected = Self.sharedBeforeLeak else {
throw XCTSkip("Runs after test1ConstructingAnAppDelegateReplacesShared in the same host")
}
XCTAssertTrue(
AppDelegate.shared === expected,
"A delegate a previous test constructed must not stay installed as AppDelegate.shared"
)
}
}

@MainActor
final class AppDelegateLaunchServicesRegistrationTests: XCTestCase {
func testDefaultTerminalRegistrationKeepsAllAdvertisedTargets() {
Expand Down
Loading