Files
MuyueWorkspace/internal/platform/platform_test.go
Augustin 3494f6b40d
All checks were successful
CI / build (push) Successful in 2m37s
feat: security hardening, tests, doctor command, CI update, CHANGELOG
- Add AES-256-GCM encryption for API keys (internal/secret)
- Add dangerous command detection in terminal
- Add muyue doctor command for system health checks
- Add scanner TTL cache, orchestrator history mutex, shared HTTP client
- Deduplicate MCP config generation, refactor skills YAML parser
- Add XDG-compliant config dir with legacy migration
- Add cleanup on all TUI quit paths
- Add 8 test files (config, workflow, skills, orchestrator, version,
  platform, scanner, secret)
- Update CI to actions/setup-go@v5
- Add CHANGELOG.md, update README and Makefile

🤖 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-04-20 19:56:07 +02:00

59 lines
1.0 KiB
Go

package platform
import (
"testing"
)
func TestDetect(t *testing.T) {
info := Detect()
if info.OS == "" {
t.Error("OS should not be empty")
}
if info.Arch == "" {
t.Error("Arch should not be empty")
}
if info.Shell == "" {
t.Error("Shell should not be empty")
}
}
func TestDetectShell(t *testing.T) {
shell := detectShell()
if shell == "" {
t.Error("Shell should not be empty")
}
}
func TestDetectPackageManager(t *testing.T) {
mgr := detectPackageManager("unknown")
if mgr != "unknown" {
t.Errorf("Unknown OS should return unknown package manager, got %s", mgr)
}
}
func TestString(t *testing.T) {
info := SystemInfo{
OS: Linux,
Arch: AMD64,
Shell: "bash",
Terminal: "unknown",
PackageManager: "apt",
}
s := info.String()
if s == "" {
t.Error("String should not be empty")
}
if !contains(s, "linux") {
t.Error("Should contain OS")
}
}
func contains(s, sub string) bool {
for i := 0; i+len(sub) <= len(s); i++ {
if s[i:i+len(sub)] == sub {
return true
}
}
return false
}