Files
Qiu YuzhouandDeepSeek Harness 7977daafea refactor: keep test doubles and test-only wrappers out of production
Move InMemoryDiagnosticReportExporter and InMemoryConfigurationGroupFileExporter
from App/PlatformEffects to Tests/Support: both are test doubles with no
production caller, and production composition wires only the AppKit adapters.

Delete RuleRuntimeCompiler.validation, a wrapper whose only callers were two
assertion blocks in the controller deployment test; those restated
custom-to-custom shadowing and validation order-independence, both pinned by
CustomRuleValidatorTests and RuleAnalysisTests. RuleRuntimeCompiler.compile
stays and keeps its production caller.

Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
2026-10-21 02:44:35 +08:00

36 lines
1.1 KiB
Swift

import Foundation
@testable import ShadowsocksX_NG2
/// 导出缝的测试替身:记录收到的 draft,但不打开保存面板、不写文件。
@MainActor
final class InMemoryDiagnosticReportExporter: DiagnosticReportExporter {
var result: DiagnosticReportExportResult
private(set) var drafts: [DiagnosticReportDraft] = []
init(result: DiagnosticReportExportResult = .cancelled) {
self.result = result
}
func export(draft: DiagnosticReportDraft) -> DiagnosticReportExportResult {
drafts.append(draft)
return result
}
}
/// 配置组文件导出缝的测试替身:同上,只记录 draft 并返回预设结果。
@MainActor
final class InMemoryConfigurationGroupFileExporter: ConfigurationGroupFileExporter {
var result: ConfigurationGroupFileExportResult
private(set) var drafts: [ConfigurationGroupExportDraft] = []
init(result: ConfigurationGroupFileExportResult = .cancelled) {
self.result = result
}
func export(draft: ConfigurationGroupExportDraft) -> ConfigurationGroupFileExportResult {
drafts.append(draft)
return result
}
}