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
2 changes: 1 addition & 1 deletion Sources/Atoms/Core/AtomKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal struct AtomKey: Hashable, Sendable, CustomStringConvertible {
let atomLabel = String(describing: anyAtomType)

if let scopeKey {
return atomLabel + "-scoped:\(scopeKey)"
return atomLabel + " scope:\(scopeKey)"
}
else {
return atomLabel
Expand Down
2 changes: 1 addition & 1 deletion Sources/Atoms/Core/ScopeKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal struct ScopeKey: Hashable, Sendable, CustomStringConvertible {

@usableFromInline
var description: String {
String(hashValue, radix: 36, uppercase: false)
"0x\(String(UInt(bitPattern: identifier), radix: 16))"
}

private init(token: Token) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/AtomsTests/Core/AtomKeyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ final class AtomKeyTests: XCTestCase {
let key1 = AtomKey(atom, scopeKey: scopeToken.key)

XCTAssertEqual(key0.description, "TestAtom<Int>")
XCTAssertEqual(key1.description, "TestAtom<Int>-scoped:\(scopeToken.key.description)")
XCTAssertEqual(key1.description, "TestAtom<Int> scope:\(scopeToken.key.description)")
}
}
12 changes: 12 additions & 0 deletions Tests/AtomsTests/Core/ScopeKeyTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest

@testable import Atoms

final class ScopeKeyTests: XCTestCase {
func testDescription() {
let token = ScopeKey.Token()
let objectAddress = String(UInt(bitPattern: ObjectIdentifier(token)), radix: 16)

XCTAssertEqual(token.key.description, "0x\(objectAddress)")
}
}
4 changes: 2 additions & 2 deletions Tests/AtomsTests/SnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ final class SnapshotTests: XCTestCase {
"TestAtom<Value2>" -> "TestAtom<Value3>"
"TestAtom<Value3>"
"TestAtom<Value3>" -> "Module/View.swift" [label="line:10"]
"TestAtom<Value4>-scoped:\(scopeToken.key.description)"
"TestAtom<Value4>-scoped:\(scopeToken.key.description)" -> "Module/View.swift" [label="line:10"]
"TestAtom<Value4> scope:\(scopeToken.key.description)"
"TestAtom<Value4> scope:\(scopeToken.key.description)" -> "Module/View.swift" [label="line:10"]
}
"""
)
Expand Down