test: add regression tests for issue #30#42
Merged
ShadyUnderLight merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
TemperatureParsingTests: 17 tests covering extractTemperature boundaries (valid range 1-120°C), invalid inputs, and multiple-number handling. EnumSavedValueTests: 18 tests for TemperatureMode and MenuBarDisplayMode savedValue initializers — both modern rawValue strings and legacy display-name strings (e.g. 'Hottest CPU'). LocalizationTests: 15 tests for L10n localizationCandidates fallback chain across en-*/zh-*/fr-/ja-JP locales, deduplication, and edge cases. DiagnosticsTests: 17 tests for ProcessSnapshotDiagnostics state machine (markAttempt / markSuccess / markFailure) and full lifecycle transitions. MonitorViewModelTests: 15 tests for ViewModel defaults, legacy settings migration (temperatureMode + menuBarDisplayMode), and fallbacks. TestExpose.swift: test-only L10n wrapper exposing localizationCandidates to the test target. Source changes: - Localization.swift: make localizationCandidates internal (was private) - SystemMetricsProvider.swift: add nonisolated extractTemperatureTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds automated regression tests for issue #30 (缺少最小自动化回归测试). The existing CI only validated compilation; these tests cover high-risk logic that can silently pass CI but behave incorrectly at runtime.
New test files
TemperatureParsingTests.swift — 17 tests
extractTemperature range validation (1-120 C), invalid inputs, first-number-wins
EnumSavedValueTests.swift — 18 tests
TemperatureMode and MenuBarDisplayMode savedValue initializers — both modern rawValue strings and legacy display-name strings (e.g. "Hottest CPU")
LocalizationTests.swift — 15 tests
L10n.localizationCandidates fallback chain across en-/zh-/fr-FR/ja-JP, deduplication
DiagnosticsTests.swift — 17 tests
ProcessSnapshotDiagnostics state machine (markAttempt / markSuccess / markFailure), full lifecycle
MonitorViewModelTests.swift — 15 tests
ViewModel defaults, legacy settings migration, invalid-value fallbacks
TestExpose.swift
Test-only L10n wrapper exposing localizationCandidates to the test target
Source changes
Test results
All 104 tests pass with 0 failures.
CI now includes swift test and will catch regressions in: