Add pure process-path to class normalization for Windows

This commit is contained in:
2026-06-02 12:18:59 -04:00
parent 885b0f9224
commit 4ea8aed04b
2 changed files with 42 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package winapi
import "testing"
func TestClassFromImagePath(t *testing.T) {
cases := []struct{ in, want string }{
{`C:\Program Files\Microsoft VS Code\Code.exe`, "code"},
{`C:\Windows\explorer.exe`, "explorer"},
{`chrome.exe`, "chrome"},
{`C:\x\FOO.EXE`, "foo"},
{`C:\x\My.App.exe`, "my.app"},
{`C:/forward/slash/Code.exe`, "code"},
{`firefox`, "firefox"},
{``, ""},
}
for _, c := range cases {
if got := ClassFromImagePath(c.in); got != c.want {
t.Errorf("ClassFromImagePath(%q) = %q, want %q", c.in, got, c.want)
}
}
}