summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-01-30 19:16:36 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-01-30 19:16:36 +0100
commit7f02ef334f00ef00afeef2ebd6e6d73f87d70d63 (patch)
treea9bb5172da4d922f15ff3b7e236eb012c3049e2f /src
parentbc63be33882f3a9540895451d8e0f470035b8fe7 (diff)
add some tests for Key functions
Diffstat (limited to 'src')
-rw-r--r--src/unit_tests.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc
index 5e91de03..fe5247c5 100644
--- a/src/unit_tests.cc
+++ b/src/unit_tests.cc
@@ -2,6 +2,7 @@
#include "assert.hh"
#include "editor.hh"
#include "selectors.hh"
+#include "keys.hh"
using namespace Kakoune;
@@ -104,10 +105,26 @@ void test_string()
assert(splited[3] == "tchou");
}
+void test_keys()
+{
+ std::vector<Key> keys{
+ { ' ' },
+ { 'c' },
+ { Key::Modifiers::Alt, 'j' },
+ { Key::Modifiers::Control, 'r' }
+ };
+ String keys_as_str;
+ for (auto& key : keys)
+ keys_as_str += key_to_str(key);
+ auto parsed_keys = parse_keys(keys_as_str);
+ assert(keys == parsed_keys);
+}
+
void run_unit_tests()
{
test_utf8();
test_string();
+ test_keys();
test_buffer();
test_editor();
test_incremental_inserter();