package platform import ( "strings" "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 !strings.Contains(s, "linux") { t.Error("Should contain OS") } }