mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-08 11:34:51 +00:00
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>
36 lines
1.1 KiB
Swift
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
|
|
}
|
|
}
|