Skip to content

Minor build fixes/cleanup #1078

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

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 21 additions & 1 deletion Tests/FoundationEssentialsTests/LockedStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import TestSupport
#endif

#if canImport(FoundationEssentials)
#if FOUNDATION_FRAMEWORK
@testable import Foundation
#else
@testable import FoundationEssentials
#endif

Expand Down Expand Up @@ -105,6 +107,24 @@ final class LockedStateTests : XCTestCase {

assertLockNotHeld(lockedState, "Lock was not properly released by withLockExtendingLifetimeOfState()")
}

func testWithLockExtendingLifespanDoesExtendLifetimeOfState() {
weak var state: TestObject?
let lockedState: LockedState<TestObject>

(state, lockedState) = {
let state = TestObject()
return (state, LockedState(initialState: state))
}()

lockedState.withLockExtendingLifetimeOfState { state in
weak var oldState = state
state = TestObject()
XCTAssertNotNil(oldState, "State object lifetime was not extended after reassignment within body")
}

XCTAssertNil(state, "State object lifetime was extended beyond end of call")
}
}

/// Assert that the locked state is not currently locked.
Expand Down

This file was deleted.

81 changes: 0 additions & 81 deletions Tests/FoundationInternationalizationTests/LockedStateTests.swift

This file was deleted.