Delete functions that no product code calls, and fold "simple plus WithOptions" pairs into the one signature callers actually use. Rename the live macOS lifecycle functions that were labelled Legacy. The architecture tests now share one source loader and reject functions without a product caller and catalog messages nobody reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
865 B
Go
38 lines
865 B
Go
package qmp
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestParseKeyCombo(t *testing.T) {
|
|
cases := []struct {
|
|
in string
|
|
key string
|
|
mods []string
|
|
wantErr bool
|
|
}{
|
|
{"meta_l+v", "v", []string{"meta_l"}, false},
|
|
{"Ctrl+Shift+V", "v", []string{"ctrl", "shift"}, false},
|
|
{" ctrl + v ", "v", []string{"ctrl"}, false},
|
|
{"f5", "f5", nil, false},
|
|
{"", "", nil, true},
|
|
{"ctrl+", "", nil, true},
|
|
{"+v", "", nil, true},
|
|
{"ctrl+v; calc", "", nil, true},
|
|
{"ctrl+shift+/", "", nil, true},
|
|
}
|
|
for _, tc := range cases {
|
|
key, mods, err := ParseKeyCombo(tc.in)
|
|
if tc.wantErr {
|
|
if err == nil {
|
|
t.Errorf("ParseKeyCombo(%q) accepted", tc.in)
|
|
}
|
|
continue
|
|
}
|
|
if err != nil || key != tc.key || !reflect.DeepEqual(mods, tc.mods) {
|
|
t.Errorf("ParseKeyCombo(%q) = %q %v %v, want %q %v", tc.in, key, mods, err, tc.key, tc.mods)
|
|
}
|
|
}
|
|
}
|