Repository navigation
Keep the icon test from writing a preferences file - #166
Conversation
The icon test used a named UserDefaults suite and deleted its file at the end. The preferences daemon wrote the file again a few seconds later, so every swift test run left one or two empty BetterTileIconTests plists in ~/Library/Preferences. #138 tried deleting the file, which cannot win that race. Use in-memory defaults in the test so nothing reaches the disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review summaryScope matches the stated goal: this only touches the test file, replaces the disk-backed One confirmed problem, left as an inline comment: the new single-instance Not verified: this review ran without macOS/Xcode available, so I could not reproduce the before/after |
Problem
Every
swift testrun left one or two emptyBetterTileIconTests-*.plistfiles in
~/Library/Preferences. The icon test used a namedUserDefaultssuite and deleted its file at the end, as #138 added. The preferences daemon
wrote the file again a few seconds after the test ended, so the delete could
not win. 691 such files had built up since the icon picker landed in #109.
Change
The icon test uses in-memory defaults, so it never reaches the disk. It still
checks that the saved choice is read back and that an unknown value falls back
to Classic.
Evidence
appIconChoiceRestoresAndFallsBackToClassiconmainleft 0 new files right after the run and 2 new files 8 seconds later. Each
was 42 bytes and contained
{}.swift testrun also left none.
swift testpasses (all three test targets). TheDebug
xcodebuildwithCODE_SIGNING_ALLOWED=NOsucceeds.Limits
UserDefaultsinstance sees a saved value. That isUserDefaultsbehavior,not BetterTile's.
The 691 leftover files on the maintainer's Mac were deleted by hand.
Safety
None. Test code only.
🤖 Generated with Claude Code