diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-05-22 13:58:56 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-05-22 13:58:56 +0100 |
| commit | dd25dcc36185a890194d09e4d0430567e76bf722 (patch) | |
| tree | b2d0ba706878bbd30b933d0dd5ecdb6a73f7df4e /src/keys.cc | |
| parent | c38a7f3ca4d63c7da94c48afa47006315deee244 (diff) | |
Move unit test functions in next to the code they are testing
Diffstat (limited to 'src/keys.cc')
| -rw-r--r-- | src/keys.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/keys.cc b/src/keys.cc index a1a6d4ad..b01fcc52 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -3,8 +3,9 @@ #include "containers.hh" #include "exception.hh" #include "string.hh" -#include "utils.hh" +#include "unit_tests.hh" #include "utf8_iterator.hh" +#include "utils.hh" namespace Kakoune { @@ -131,4 +132,19 @@ String key_to_str(Key key) return res; } +UnitTest test_keys{[]() +{ + KeyList 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); + kak_assert(keys == parsed_keys); +}}; + } |
