MCPcopy
hub / github.com/jesseduffield/lazygit / TestKeyFromLabel

Function TestKeyFromLabel

pkg/config/keynames_test.go:10–566  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestKeyFromLabel(t *testing.T) {
11 scenarios := []struct {
12 name string
13 label string
14 expectedKey gocui.Key
15 expectedOk bool
16 }{
17 // Empty / disabled
18 {
19 name: "empty string returns unset key",
20 label: "",
21 expectedKey: gocui.Key{},
22 expectedOk: true,
23 },
24 {
25 name: "<disabled> returns unset key",
26 label: "<disabled>",
27 expectedKey: gocui.Key{},
28 expectedOk: true,
29 },
30
31 // Plain runes (unwrapped)
32 {
33 name: "single lowercase letter",
34 label: "a",
35 expectedKey: gocui.NewKeyStrMod("a", gocui.ModNone),
36 expectedOk: true,
37 },
38 {
39 name: "single uppercase letter",
40 label: "A",
41 expectedKey: gocui.NewKeyStrMod("A", gocui.ModNone),
42 expectedOk: true,
43 },
44 {
45 name: "single digit",
46 label: "5",
47 expectedKey: gocui.NewKeyStrMod("5", gocui.ModNone),
48 expectedOk: true,
49 },
50 {
51 name: "punctuation rune",
52 label: "?",
53 expectedKey: gocui.NewKeyStrMod("?", gocui.ModNone),
54 expectedOk: true,
55 },
56 {
57 name: "multibyte rune",
58 label: "ñ",
59 expectedKey: gocui.NewKeyStrMod("ñ", gocui.ModNone),
60 expectedOk: true,
61 },
62 {
63 name: "bare dash is treated as a rune",
64 label: "-",
65 expectedKey: gocui.NewKeyRune('-'),
66 expectedOk: true,
67 },

Callers

nothing calls this directly

Calls 5

NewKeyStrModFunction · 0.92
NewKeyRuneFunction · 0.92
NewKeyFunction · 0.92
KeyFromLabelFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected