Implement parsing of map

This commit is contained in:
Kovid Goyal
2023-03-15 22:07:44 +05:30
parent e4fbcb707f
commit 5329546f21
4 changed files with 146 additions and 1 deletions

View File

@@ -4,7 +4,10 @@ package config
import (
"fmt"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
)
var _ = fmt.Print
@@ -24,3 +27,18 @@ func TestStringLiteralParsing(t *testing.T) {
}
}
}
func TestNormalizeShortcuts(t *testing.T) {
for q, expected_ := range map[string]string{
`a`: `a`,
`+`: `plus`,
`cmd+b>opt+>`: `super+b alt+>`,
`cmd+>>opt+>`: `super+> alt+>`,
} {
expected := strings.Split(expected_, " ")
actual := NormalizeShortcuts(q)
if diff := cmp.Diff(expected, actual); diff != "" {
t.Fatalf("failed with input: %#v\n%s", q, diff)
}
}
}