From e2954779515e3f5fce0719075893036fc5579c3f Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 30 Apr 2025 17:31:48 +0200 Subject: [PATCH] Add test demonstrating missing validation for custom commands in sub menus We only validate the commands at top level right now. --- pkg/config/user_config_validation_test.go | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/config/user_config_validation_test.go b/pkg/config/user_config_validation_test.go index 813cfc7c8..d32b29c6f 100644 --- a/pkg/config/user_config_validation_test.go +++ b/pkg/config/user_config_validation_test.go @@ -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: "", valid: true}, + {value: "q", valid: true}, + {value: "", valid: true}, + /* EXPECTED: + {value: "invalid_value", valid: false}, + ACTUAL */ + {value: "invalid_value", valid: true}, + }, + }, { name: "Custom command sub menu", setup: func(config *UserConfig, _ string) {