mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-14 20:08:12 +08:00
- 将 macOS 原生窗口诊断改为默认关闭 - 仅在显式设置 GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS 时启用后端诊断 - 仅在前端开发环境启用窗口诊断采集 - 避免正式构建在启动阶段附加额外窗口状态探测与日志观察 - 为诊断开关补充前后端最小回归测试 Refs: #360
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package app
|
|
|
|
import "testing"
|
|
|
|
func TestShouldInstallMacNativeWindowDiagnosticsDefaultsDisabled(t *testing.T) {
|
|
t.Setenv("GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS", "")
|
|
|
|
if shouldInstallMacNativeWindowDiagnostics() {
|
|
t.Fatal("expected mac native window diagnostics to stay disabled by default")
|
|
}
|
|
}
|
|
|
|
func TestShouldInstallMacNativeWindowDiagnosticsHonorsEnvOptIn(t *testing.T) {
|
|
t.Setenv("GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS", "1")
|
|
|
|
if !shouldInstallMacNativeWindowDiagnostics() {
|
|
t.Fatal("expected mac native window diagnostics to enable when explicitly opted in")
|
|
}
|
|
|
|
t.Setenv("GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS", "true")
|
|
if !shouldInstallMacNativeWindowDiagnostics() {
|
|
t.Fatal("expected mac native window diagnostics to accept true as opt-in value")
|
|
}
|
|
|
|
t.Setenv("GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS", "0")
|
|
if shouldInstallMacNativeWindowDiagnostics() {
|
|
t.Fatal("expected mac native window diagnostics to stay disabled for non-opt-in values")
|
|
}
|
|
}
|
|
|
|
func TestShouldInstallMacNativeWindowDiagnosticsIgnoresCaseAndWhitespace(t *testing.T) {
|
|
t.Setenv("GONAVI_ENABLE_MAC_WINDOW_DIAGNOSTICS", " TRUE ")
|
|
|
|
if !shouldInstallMacNativeWindowDiagnostics() {
|
|
t.Fatal("expected helper to trim and lowercase opt-in values")
|
|
}
|
|
}
|