Skip to content
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
5 changes: 5 additions & 0 deletions Sources/Atoms/Core/SourceLocation.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
internal struct SourceLocation: Equatable {
let fileID: String
let line: UInt

init(fileID: String = #fileID, line: UInt = #line) {
self.fileID = fileID
self.line = line
}
}
8 changes: 4 additions & 4 deletions Tests/AtomsTests/Core/StoreContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class StoreContextTests: XCTestCase {
store.state.caches[key] = AtomCache(atom: atom, value: 0)
store.state.states[key] = AtomState(coordinator: atom.makeCoordinator())
store.state.subscriptions[key, default: [:]][subscriptionKey] = Subscription(
location: SourceLocation(fileID: #file, line: #line),
location: SourceLocation(),
requiresObjectUpdate: false,
notifyUpdate: { updateCount += 1 },
unsubscribe: {}
Expand Down Expand Up @@ -147,7 +147,7 @@ final class StoreContextTests: XCTestCase {
store.state.caches[key] = AtomCache(atom: atom, value: 0)
store.state.states[key] = AtomState(coordinator: atom.makeCoordinator())
store.state.subscriptions[key, default: [:]][subscriptionKey] = Subscription(
location: SourceLocation(fileID: #file, line: #line),
location: SourceLocation(),
requiresObjectUpdate: false,
notifyUpdate: { updateCount += 1 },
unsubscribe: {}
Expand Down Expand Up @@ -303,7 +303,7 @@ final class StoreContextTests: XCTestCase {
key0: AtomCache(atom: atom0, value: 0),
key1: AtomCache(atom: atom1, value: 1),
]
let subscription = Subscription(location: SourceLocation(fileID: #file, line: #line), requiresObjectUpdate: false, notifyUpdate: {}) {}
let subscription = Subscription(location: SourceLocation(), requiresObjectUpdate: false, notifyUpdate: {}) {}

store.graph = graph
store.state.caches = caches
Expand Down Expand Up @@ -836,7 +836,7 @@ final class StoreContextTests: XCTestCase {
let atom0 = TestAtom(value: 0)
let atom1 = TestAtom(value: 1)
let atom2 = TestAtom(value: 2)
let location = SourceLocation(fileID: #file, line: #line)
let location = SourceLocation()
let token = SubscriptionKey.Token()
let subscriptionKey = SubscriptionKey(token: token)

Expand Down
4 changes: 2 additions & 2 deletions Tests/AtomsTests/Core/SubscriptionContainerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final class SubscriptionContainerTests: XCTestCase {
var container: SubscriptionContainer? = SubscriptionContainer()
var unsubscribedCount = 0
let subscription = Subscription(
location: SourceLocation(fileID: #file, line: #line),
location: SourceLocation(),
requiresObjectUpdate: false,
notifyUpdate: {}
) {
Expand All @@ -28,7 +28,7 @@ final class SubscriptionContainerTests: XCTestCase {
}

func testWrapper() {
let location = SourceLocation(fileID: #file, line: #line)
let location = SourceLocation()
let container0 = SubscriptionContainer()
let container1 = container0
let container2 = SubscriptionContainer()
Expand Down
2 changes: 1 addition & 1 deletion Tests/AtomsTests/Utilities/Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension AtomKey {

extension SubscriptionContainer {
var wrapper: Wrapper {
let location = SourceLocation(fileID: #fileID, line: #line)
let location = SourceLocation()
return wrapper(location: location)
}
}
Expand Down