Skip to content

Commit

Permalink
Fix lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrpb committed Nov 19, 2024
1 parent 907dfae commit 4754c96
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ extension ObservableDefaultMacro {
Generates the token to use as key for the associated object used to hold the UserDefaults observation.
*/
private static func associatedKeyToken(for property: TokenSyntax) -> TokenSyntax {
return "_objcAssociatedKey_\(property)"
"_objcAssociatedKey_\(property)"
}
}

Expand Down
38 changes: 19 additions & 19 deletions Tests/DefaultsMacrosTests/ObservableDefaultTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,86 +84,86 @@ final class ObservableDefaultTests {
func testMacroWithMemberSyntax() async {
let model = TestModelWithMemberSyntax()
#expect(model.animal == defaultAnimal)

let userDefaultsValue = UserDefaults.standard.string(forKey: animalKey)
#expect(userDefaultsValue == defaultAnimal)

await confirmation { confirmation in
_ = withObservationTracking {
model.animal
} onChange: {
confirmation()
}

UserDefaults.standard.set(newAnimal, forKey: animalKey)
}

#expect(model.animal == newAnimal)
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, visionOS 1, *)
@Test
func testMacroWithDotSyntax() async {
let model = TestModelWithDotSyntax()
#expect(model.animal == defaultAnimal)

let userDefaultsValue = UserDefaults.standard.string(forKey: animalKey)
#expect(userDefaultsValue == defaultAnimal)

await confirmation { confirmation in
_ = withObservationTracking {
model.animal
} onChange: {
confirmation()
}

UserDefaults.standard.set(newAnimal, forKey: animalKey)
}

#expect(model.animal == newAnimal)
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, visionOS 1, *)
@Test
func testMacroWithFunctionCall() async {
let model = TestModelWithFunctionCall()
#expect(model.animal == defaultAnimal)

let userDefaultsValue = UserDefaults.standard.string(forKey: animalKey)
#expect(userDefaultsValue == defaultAnimal)

await confirmation { confirmation in
_ = withObservationTracking {
model.animal
} onChange: {
confirmation()
}

UserDefaults.standard.set(newAnimal, forKey: animalKey)
}

#expect(model.animal == newAnimal)
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, visionOS 1, *)
@Test
func testMacroWithProperty() async {
let model = TestModelWithProperty()
#expect(model.animal == defaultAnimal)

let userDefaultsValue = UserDefaults.standard.string(forKey: animalKey)
#expect(userDefaultsValue == defaultAnimal)

await confirmation { confirmation in
_ = withObservationTracking {
model.animal
} onChange: {
confirmation()
}

UserDefaults.standard.set(newAnimal, forKey: animalKey)
}

#expect(model.animal == newAnimal)
}

Expand Down

0 comments on commit 4754c96

Please sign in to comment.