aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/kbd.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/kbd.scm b/test/kbd.scm
new file mode 100644
index 0000000..52eb3d3
--- /dev/null
+++ b/test/kbd.scm
@@ -0,0 +1,28 @@
+(define-module (test kbd)
+ #:use-module (srfi srfi-64)
+ #:use-module (oni kbd))
+
+(test-begin "kbd-test")
+
+(test-equal "Any letter alone is untouched"
+ "s" (kbd "s"))
+(test-equal "The `s' modifier is converted to `Mod4'"
+ "Mod4-s" (kbd "s-s"))
+(test-equal "The `S' modifier is converted to `Shift'"
+ "Shift-s" (kbd "S-s"))
+(test-equal "The `M' modifier is converted to `Mod1'"
+ "Mod1-x" (kbd "M-x"))
+(test-equal "The `C' modifier is converted to `Ctrl'"
+ "Ctrl-f" (kbd "C-f"))
+(test-equal "Two modifiers can be combined"
+ "Mod4-Shift-q" (kbd "s-S-q"))
+(test-equal "Three modifiers can be combined"
+ "Mod4-Shift-Ctrl-f" (kbd "s-S-C-f"))
+(test-equal "The `RET' key is converted to `Return'"
+ "Mod4-Return" (kbd "s-RET"))
+(test-equal "The `SPC' key is converted to `space'"
+ "Ctrl-space" (kbd "C-SPC"))
+(test-equal "The `<backspace>' key is converted to `BackSpace'"
+ "Mod1-BackSpace" (kbd "M-<backspace>"))
+
+(test-end "kbd-test")