Skip to content

Commit e295477

Browse files
committed
Add test demonstrating missing validation for custom commands in sub menus
We only validate the commands at top level right now.
1 parent 7137196 commit e295477

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pkg/config/user_config_validation_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,30 @@ func TestUserConfigValidate_enums(t *testing.T) {
7474
{value: "invalid_value", valid: false},
7575
},
7676
},
77+
{
78+
name: "Custom command keybinding in sub menu",
79+
setup: func(config *UserConfig, value string) {
80+
config.CustomCommands = []CustomCommand{
81+
{
82+
Key: "X",
83+
Description: "My Custom Commands",
84+
CommandMenu: []CustomCommand{
85+
{Key: value, Command: "echo 'hello'", Context: "global"},
86+
},
87+
},
88+
}
89+
},
90+
testCases: []testCase{
91+
{value: "", valid: true},
92+
{value: "<disabled>", valid: true},
93+
{value: "q", valid: true},
94+
{value: "<c-c>", valid: true},
95+
/* EXPECTED:
96+
{value: "invalid_value", valid: false},
97+
ACTUAL */
98+
{value: "invalid_value", valid: true},
99+
},
100+
},
77101
{
78102
name: "Custom command sub menu",
79103
setup: func(config *UserConfig, _ string) {

0 commit comments

Comments
 (0)