aboutsummaryrefslogtreecommitdiffstats
path: root/config/binds_test.go
diff options
context:
space:
mode:
authorVitaly Ovchinnikov <v@ovch.ru>2024-04-02 09:47:58 +0000
committerRobin Jarry <robin@jarry.cc>2024-04-13 21:47:32 +0200
commitbd489a1c9017d1d8ac6aecff98f98939007273cd (patch)
tree7476cdac63c690e1364dba2c58ffac98b38607af /config/binds_test.go
parenta67fd7cb544b065b766fde65df7011f9190dcf39 (diff)
downloadaerc-bd489a1c9017d1d8ac6aecff98f98939007273cd.tar.gz
binds: fix FormatKeyStrokes to properly display certain keystrokes
Fix FormatKeyStrokes so it properly displays the strokes that are not directly listed in `keyNames`, like ctrl+left, ctrl+pgup etc. Add a test to check that the strokes are now formatted. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/binds_test.go')
-rw-r--r--config/binds_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/config/binds_test.go b/config/binds_test.go
index 7d4cd779..7325252d 100644
--- a/config/binds_test.go
+++ b/config/binds_test.go
@@ -85,3 +85,17 @@ func TestGetBinding(t *testing.T) {
{vaxis.ModShift, vaxis.KeyUp},
}, BINDING_FOUND, ":open")
}
+
+func TestKeyStrokeFormatting(t *testing.T) {
+ tests := []struct {
+ stroke KeyStroke
+ formatted string
+ }{
+ {KeyStroke{vaxis.ModifierMask(0), vaxis.KeyLeft}, "<left>"},
+ {KeyStroke{vaxis.ModCtrl, vaxis.KeyLeft}, "c-<left>"},
+ }
+
+ for _, test := range tests {
+ assert.Equal(t, test.formatted, FormatKeyStrokes([]KeyStroke{test.stroke}))
+ }
+}