diff options
author | 2021-04-03 18:27:28 +0200 | |
---|---|---|
committer | 2021-04-04 21:58:50 +0200 | |
commit | 9df41252dec381d56a2c54d2238d03c268ef890f (patch) | |
tree | 56614496700f09c8fcbf532fdf486fd09fa2c0fa /test/keymap.cpp | |
parent | e76d0b88323c715e21ca93a9dfc15048abf732b1 (diff) | |
download | newsboat-9df41252dec381d56a2c54d2238d03c268ef890f.tar.gz newsboat-9df41252dec381d56a2c54d2238d03c268ef890f.tar.zst newsboat-9df41252dec381d56a2c54d2238d03c268ef890f.zip |
Escape quotes and backslashes when dumping macro descriptions
Diffstat (limited to '')
-rw-r--r-- | test/keymap.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/keymap.cpp b/test/keymap.cpp index 785b5e63..f4fa30f1 100644 --- a/test/keymap.cpp +++ b/test/keymap.cpp @@ -488,6 +488,33 @@ TEST_CASE("dump_config() returns a line for each keybind and macro", "[KeyMap]") } } +TEST_CASE("dump_config() stores a description if it is present", "[KeyMap]") +{ + KeyMap k(KM_NEWSBOAT); + + std::vector<std::string> dumpOutput; + + GIVEN("a few macros, some with a description") { + k.unset_all_keys("all"); + + k.handle_action("macro", R"(x open -- "first description")"); + k.handle_action("macro", R"(y set m n -- "configure \"m\" \\ ")"); + k.handle_action("macro", R"(z set var I)"); + + WHEN("calling dump_config()") { + k.dump_config(dumpOutput); + + THEN("there is one line per configured macro ; all given descriptions are included") { + REQUIRE(dumpOutput.size() == 3); + + REQUIRE(dumpOutput[0] == R"(macro x open -- "first description")"); + REQUIRE(dumpOutput[1] == R"(macro y set "m" "n" -- "configure \"m\" \\ ")"); + REQUIRE(dumpOutput[2] == R"(macro z set "var" "I")"); + } + } + } +} + TEST_CASE("Regression test for https://github.com/newsboat/newsboat/issues/702", "[KeyMap]") { |