Add test demonstrating missing validation for custom commands in sub menus

We only validate the commands at top level right now.
This commit is contained in:
Stefan Haller 2025-04-30 17:31:48 +02:00
parent 7137196788
commit e295477951

View file

@ -74,6 +74,30 @@ func TestUserConfigValidate_enums(t *testing.T) {
{value: "invalid_value", valid: false},
},
},
{
name: "Custom command keybinding in sub menu",
setup: func(config *UserConfig, value string) {
config.CustomCommands = []CustomCommand{
{
Key: "X",
Description: "My Custom Commands",
CommandMenu: []CustomCommand{
{Key: value, Command: "echo 'hello'", Context: "global"},
},
},
}
},
testCases: []testCase{
{value: "", valid: true},
{value: "<disabled>", valid: true},
{value: "q", valid: true},
{value: "<c-c>", valid: true},
/* EXPECTED:
{value: "invalid_value", valid: false},
ACTUAL */
{value: "invalid_value", valid: true},
},
},
{
name: "Custom command sub menu",
setup: func(config *UserConfig, _ string) {