1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| package hotkey
|
| import "testing"
|
| func TestGetKeyNameForPlatformRightModifier(t *testing.T) {
| tests := []struct {
| name string
| goos string
| vk int
| want string
| }{
| {name: "darwin left command", goos: "darwin", vk: 0x5B, want: "L-⌘"},
| {name: "darwin right command", goos: "darwin", vk: 0x5C, want: "R-⌘"},
| {name: "unset", goos: "darwin", vk: 0, want: ""},
| {name: "windows left windows", goos: "windows", vk: 0x5B, want: "L-Win"},
| {name: "windows right windows", goos: "windows", vk: 0x5C, want: "R-Win"},
| {name: "linux right windows fallback", goos: "linux", vk: 0x5C, want: "R-Win"},
| }
|
| for _, tt := range tests {
| t.Run(tt.name, func(t *testing.T) {
| if got := GetKeyNameForPlatform(tt.vk, tt.goos); got != tt.want {
| t.Fatalf("GetKeyNameForPlatform(0x%X, %q) = %q, want %q", tt.vk, tt.goos, got, tt.want)
| }
| })
| }
| }
|
|